Merge pull request #33315 from Mic92/borgbackup

nixos/borgbackup: add test

authored by Jörg Thalheim and committed by GitHub 4e9756da ad069c36

+22
+1
nixos/release.nix
··· 227 227 tests.blivet = callTest tests/blivet.nix {}; 228 228 tests.boot = callSubTests tests/boot.nix {}; 229 229 tests.boot-stage1 = callTest tests/boot-stage1.nix {}; 230 + tests.borgbackup = callTest tests/borgbackup.nix {}; 230 231 tests.cadvisor = callTestOnTheseSystems ["x86_64-linux"] tests/cadvisor.nix {}; 231 232 tests.chromium = (callSubTestsOnTheseSystems ["x86_64-linux"] tests/chromium.nix {}).stable; 232 233 tests.cjdns = callTest tests/cjdns.nix {};
+21
nixos/tests/borgbackup.nix
··· 1 + import ./make-test.nix ({ pkgs, ...}: { 2 + name = "borgbackup"; 3 + meta = with pkgs.stdenv.lib.maintainers; { 4 + maintainers = [ mic92 ]; 5 + }; 6 + 7 + nodes = { 8 + machine = { config, pkgs, ... }: { 9 + environment.systemPackages = [ pkgs.borgbackup ]; 10 + }; 11 + }; 12 + 13 + testScript = '' 14 + my $borg = "BORG_PASSPHRASE=supersecret borg"; 15 + $machine->succeed("$borg init --encryption=repokey /tmp/backup"); 16 + $machine->succeed("mkdir /tmp/data/ && echo 'data' >/tmp/data/file"); 17 + $machine->succeed("$borg create --stats /tmp/backup::test /tmp/data"); 18 + $machine->succeed("$borg extract /tmp/backup::test"); 19 + $machine->succeed('c=$(cat data/file) && echo "c = $c" >&2 && [[ "$c" == "data" ]]'); 20 + ''; 21 + })