about summary refs log tree commit diff
path: root/nixos/tests
diff options
context:
space:
mode:
authorAlan Strohm <3605394+alan-strohm@users.noreply.github.com>2022-07-27 10:47:41 -0700
committerGitHub <noreply@github.com>2022-07-27 13:47:41 -0400
commit81cd3e229cb1e0a4651f9747864059a79812d2fe (patch)
tree171e9167736318a260a87d53a6969753417973f2 /nixos/tests
parent2f6dce6bd1c49f18178825116cd3942d3f974001 (diff)
nixos/restic: add 'backups.package' option to override the restic package (#183028)
Diffstat (limited to 'nixos/tests')
-rw-r--r--nixos/tests/restic.nix9
1 files changed, 9 insertions, 0 deletions
diff --git a/nixos/tests/restic.nix b/nixos/tests/restic.nix
index 7523d5e5ed5da..75fffe9d9a84d 100644
--- a/nixos/tests/restic.nix
+++ b/nixos/tests/restic.nix
@@ -63,6 +63,12 @@ import ./make-test-python.nix (
               inherit repository passwordFile;
               pruneOpts = [ "--keep-last 1" ];
             };
+            custompackage = {
+              inherit repository passwordFile paths;
+              package = pkgs.writeShellScriptBin "restic" ''
+                echo "$@" >> /tmp/fake-restic.log;
+              '';
+            };
           };
 
           environment.sessionVariables.RCLONE_CONFIG_LOCAL_TYPE = "local";
@@ -76,6 +82,7 @@ import ./make-test-python.nix (
           "${pkgs.restic}/bin/restic -r ${repository} -p ${passwordFile} snapshots",
           '${pkgs.restic}/bin/restic --repository-file ${repositoryFile} -p ${passwordFile} snapshots"',
           "${pkgs.restic}/bin/restic -r ${rcloneRepository} -p ${passwordFile} snapshots",
+          "grep 'backup .* /opt' /tmp/fake-restic.log",
       )
       server.succeed(
           "mkdir -p /opt",
@@ -89,6 +96,8 @@ import ./make-test-python.nix (
           '${pkgs.restic}/bin/restic -r ${repository} -p ${passwordFile} snapshots -c | grep -e "^1 snapshot"',
           '${pkgs.restic}/bin/restic --repository-file ${repositoryFile} -p ${passwordFile} snapshots -c | grep -e "^1 snapshot"',
           '${pkgs.restic}/bin/restic -r ${rcloneRepository} -p ${passwordFile} snapshots -c | grep -e "^1 snapshot"',
+          "systemctl start restic-backups-custompackage.service",
+          "grep 'backup .* /opt' /tmp/fake-restic.log",
           "timedatectl set-time '2017-12-13 13:45'",
           "systemctl start restic-backups-remotebackup.service",
           "rm /opt/backupCleanupCommand",