From b1595ae6d33b938cb856e34a9e941b77e7b1ad17 Mon Sep 17 00:00:00 2001 From: Robert Obryk Date: Tue, 7 Nov 2023 21:08:44 +0100 Subject: [PATCH] nixos/restic: test that `initialize = false` works correctly This is a test that was proposed in #264849, which was not merged in favour of #264882. Based-on-patch-by: "Patrick Steinhardt" --- nixos/tests/restic.nix | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/nixos/tests/restic.nix b/nixos/tests/restic.nix index 868ccb7efd74..6cf5ca93d144 100644 --- a/nixos/tests/restic.nix +++ b/nixos/tests/restic.nix @@ -120,8 +120,15 @@ 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", + ) + server.fail( + # test that noinit backup in fact does not initialize the repository + # and thus fails without a pre-initialized repository + "systemctl start restic-backups-remote-noinit-backup.service", + ) + + server.succeed( # test that remotebackup runs custom commands and produces a snapshot "timedatectl set-time '2016-12-13 13:45'", "systemctl start restic-backups-remotebackup.service", @@ -137,7 +144,8 @@ 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 + # test that remote-noinit-backup produces a snapshot once initialized + "restic-remote-noinit-backup init", "systemctl start restic-backups-remote-noinit-backup.service", 'restic-remote-noinit-backup snapshots --json | ${pkgs.jq}/bin/jq "length | . == 1"',