diff options
author | pennae <github@quasiparticle.net> | 2021-10-11 15:28:56 +0200 |
---|---|---|
committer | tomberek <tomberek@users.noreply.github.com> | 2021-10-22 16:31:50 -0400 |
commit | 1fa5e13f30c60890b01475d7945a17ca5721a5f2 (patch) | |
tree | e10c77a522b47ac61b32efd0f27ae1e69871f6a1 /nixos/tests/borgbackup.nix | |
parent | c47fcb70c6885d6df869934280ebeb715ca7e6fd (diff) | |
download | nixpkgs-1fa5e13f30c60890b01475d7945a17ca5721a5f2.tar nixpkgs-1fa5e13f30c60890b01475d7945a17ca5721a5f2.tar.gz nixpkgs-1fa5e13f30c60890b01475d7945a17ca5721a5f2.tar.bz2 nixpkgs-1fa5e13f30c60890b01475d7945a17ca5721a5f2.tar.lz nixpkgs-1fa5e13f30c60890b01475d7945a17ca5721a5f2.tar.xz nixpkgs-1fa5e13f30c60890b01475d7945a17ca5721a5f2.tar.zst nixpkgs-1fa5e13f30c60890b01475d7945a17ca5721a5f2.zip |
nixos/borgbackup: allow dump scripts as stdin inputs
borg is able to process stdin during backups when backing up the special path -, which can be very useful for backing up things that can be streamed (eg database dumps, zfs snapshots).
Diffstat (limited to 'nixos/tests/borgbackup.nix')
-rw-r--r-- | nixos/tests/borgbackup.nix | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/nixos/tests/borgbackup.nix b/nixos/tests/borgbackup.nix index fae1d2d0713..cbb28689209 100644 --- a/nixos/tests/borgbackup.nix +++ b/nixos/tests/borgbackup.nix @@ -81,6 +81,24 @@ in { environment.BORG_RSH = "ssh -oStrictHostKeyChecking=no -i /root/id_ed25519.appendOnly"; }; + commandSuccess = { + dumpCommand = pkgs.writeScript "commandSuccess" '' + echo -n test + ''; + repo = remoteRepo; + encryption.mode = "none"; + startAt = [ ]; + environment.BORG_RSH = "ssh -oStrictHostKeyChecking=no -i /root/id_ed25519"; + }; + + commandFail = { + dumpCommand = "${pkgs.coreutils}/bin/false"; + repo = remoteRepo; + encryption.mode = "none"; + startAt = [ ]; + environment.BORG_RSH = "ssh -oStrictHostKeyChecking=no -i /root/id_ed25519"; + }; + }; }; @@ -171,5 +189,20 @@ in { client.fail("{} list borg\@server:wrong".format(borg)) # TODO: Make sure that data is not actually deleted + + with subtest("commandSuccess"): + server.wait_for_unit("sshd.service") + client.wait_for_unit("network.target") + client.systemctl("start --wait borgbackup-job-commandSuccess") + client.fail("systemctl is-failed borgbackup-job-commandSuccess") + id = client.succeed("borg-job-commandSuccess list | tail -n1 | cut -d' ' -f1").strip() + client.succeed(f"borg-job-commandSuccess extract ::{id} stdin") + assert "test" == client.succeed("cat stdin") + + with subtest("commandFail"): + server.wait_for_unit("sshd.service") + client.wait_for_unit("network.target") + client.systemctl("start --wait borgbackup-job-commandFail") + client.succeed("systemctl is-failed borgbackup-job-commandFail") ''; }) |