From 00aad1290aa665b1bc3ccd90728773f934ad662f Mon Sep 17 00:00:00 2001 From: Tert0 Date: Fri, 7 Nov 2025 00:27:54 +0100 Subject: [PATCH] nixos/tests/restic: fix setting time in tests Use `date -s` instead of `timedatectl set-time` because it fails with `Failed to set time: Requested to set the clock to time before build time, refusing.` --- nixos/tests/restic.nix | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/nixos/tests/restic.nix b/nixos/tests/restic.nix index 68777215c035..68ce843879b3 100644 --- a/nixos/tests/restic.nix +++ b/nixos/tests/restic.nix @@ -247,7 +247,7 @@ in restic.succeed( # test that remotebackup runs custom commands and produces a snapshot - "timedatectl set-time '2016-12-13 13:45'", + "date -s '2016-12-13 13:45'", "systemctl start restic-backups-remotebackup.service", "rm /root/backupCleanupCommand", 'restic-remotebackup snapshots --json | ${pkgs.jq}/bin/jq "length | . == 1"', @@ -255,7 +255,7 @@ in restic.succeed( # test that remotebackup runs custom commands and produces a snapshot - "timedatectl set-time '2016-12-13 13:45'", + "date -s '2016-12-13 13:45'", "systemctl start restic-backups-remotebackup.service", "rm /root/backupCleanupCommand", 'restic-remotebackup snapshots --json | ${pkgs.jq}/bin/jq "length | . == 1"', @@ -297,27 +297,27 @@ in "grep 'check.* --some-check-option' /root/fake-restic.log", # test that we can create four snapshots in remotebackup and rclonebackup - "timedatectl set-time '2017-12-13 13:45'", + "date -s '2017-12-13 13:45'", "systemctl start restic-backups-remotebackup.service", "rm /root/backupCleanupCommand", "systemctl start restic-backups-rclonebackup.service", - "timedatectl set-time '2018-12-13 13:45'", + "date -s '2018-12-13 13:45'", "systemctl start restic-backups-remotebackup.service", "rm /root/backupCleanupCommand", "systemctl start restic-backups-rclonebackup.service", - "timedatectl set-time '2018-12-14 13:45'", + "date -s '2018-12-14 13:45'", "systemctl start restic-backups-remotebackup.service", "rm /root/backupCleanupCommand", "systemctl start restic-backups-rclonebackup.service", - "timedatectl set-time '2018-12-15 13:45'", + "date -s '2018-12-15 13:45'", "systemctl start restic-backups-remotebackup.service", "rm /root/backupCleanupCommand", "systemctl start restic-backups-rclonebackup.service", - "timedatectl set-time '2018-12-16 13:45'", + "date -s '2018-12-16 13:45'", "systemctl start restic-backups-remotebackup.service", "rm /root/backupCleanupCommand", "systemctl start restic-backups-rclonebackup.service",