summary refs log tree commit diff
path: root/nixos/tests
diff options
context:
space:
mode:
authorJanik <80165193+Janik-Haag@users.noreply.github.com>2023-11-07 09:46:55 +0100
committerGitHub <noreply@github.com>2023-11-07 09:46:55 +0100
commit22aa256c6ceab1845b190cbac072bcca3a20daf0 (patch)
tree7ba8ceb52c9368a54070a0cd0dc8e3e2b055a5d7 /nixos/tests
parentdcd6057e4a14741c2746ba12428f0cb359e23fc6 (diff)
parent536401e90aa3c74d2f0226f4e55a005dc8f9eac3 (diff)
downloadnixpkgs-22aa256c6ceab1845b190cbac072bcca3a20daf0.tar
nixpkgs-22aa256c6ceab1845b190cbac072bcca3a20daf0.tar.gz
nixpkgs-22aa256c6ceab1845b190cbac072bcca3a20daf0.tar.bz2
nixpkgs-22aa256c6ceab1845b190cbac072bcca3a20daf0.tar.lz
nixpkgs-22aa256c6ceab1845b190cbac072bcca3a20daf0.tar.xz
nixpkgs-22aa256c6ceab1845b190cbac072bcca3a20daf0.tar.zst
nixpkgs-22aa256c6ceab1845b190cbac072bcca3a20daf0.zip
Merge pull request #264882 from robryk/resticfix
nixos/restic: fix #264696 and add a regression test
Diffstat (limited to 'nixos/tests')
-rw-r--r--nixos/tests/restic.nix11
1 files changed, 11 insertions, 0 deletions
diff --git a/nixos/tests/restic.nix b/nixos/tests/restic.nix
index 54fdc1d3995..868ccb7efd7 100644
--- a/nixos/tests/restic.nix
+++ b/nixos/tests/restic.nix
@@ -4,6 +4,7 @@ import ./make-test-python.nix (
   let
     remoteRepository = "/root/restic-backup";
     remoteFromFileRepository = "/root/restic-backup-from-file";
+    remoteNoInitRepository = "/root/restic-backup-no-init";
     rcloneRepository = "rclone:local:/root/restic-rclone-backup";
 
     backupPrepareCommand = ''
@@ -64,6 +65,11 @@ import ./make-test-python.nix (
                 find /opt -mindepth 1 -maxdepth 1 ! -name a_dir # all files in /opt except for a_dir
               '';
             };
+            remote-noinit-backup = {
+              inherit passwordFile exclude pruneOpts paths;
+              initialize = false;
+              repository = remoteNoInitRepository;
+            };
             rclonebackup = {
               inherit passwordFile paths exclude pruneOpts;
               initialize = true;
@@ -114,6 +120,7 @@ import ./make-test-python.nix (
           "cp -rT ${testDir} /opt",
           "touch /opt/excluded_file_1 /opt/excluded_file_2",
           "mkdir -p /root/restic-rclone-backup",
+          "restic-remote-noinit-backup init",
 
           # test that remotebackup runs custom commands and produces a snapshot
           "timedatectl set-time '2016-12-13 13:45'",
@@ -130,6 +137,10 @@ import ./make-test-python.nix (
           "systemctl start restic-backups-remote-from-file-backup.service",
           'restic-remote-from-file-backup snapshots --json | ${pkgs.jq}/bin/jq "length | . == 1"',
 
+          # test that remote-noinit-backup produces a snapshot
+          "systemctl start restic-backups-remote-noinit-backup.service",
+          'restic-remote-noinit-backup snapshots --json | ${pkgs.jq}/bin/jq "length | . == 1"',
+
           # test that restoring that snapshot produces the same directory
           "mkdir /tmp/restore-2",
           "${pkgs.restic}/bin/restic -r ${remoteRepository} -p ${passwordFile} restore latest -t /tmp/restore-2",