From be4d9c27325718e0d9530f12f7ea6eb86baa65e8 Mon Sep 17 00:00:00 2001 From: Tert0 Date: Thu, 6 Nov 2025 21:23:16 +0100 Subject: [PATCH] nixos/tests/restic-rest-server: 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-rest-server.nix | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/nixos/tests/restic-rest-server.nix b/nixos/tests/restic-rest-server.nix index 9e6753d91b2a..c224515b586e 100644 --- a/nixos/tests/restic-rest-server.nix +++ b/nixos/tests/restic-rest-server.nix @@ -86,7 +86,7 @@ in "touch /opt/excluded_file_1 /opt/excluded_file_2", # 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"', @@ -97,23 +97,23 @@ in "diff -ru ${testDir} /tmp/restore-1/opt", # 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", - "timedatectl set-time '2018-12-13 13:45'", + "date -s '2018-12-13 13:45'", "systemctl start restic-backups-remotebackup.service", "rm /root/backupCleanupCommand", - "timedatectl set-time '2018-12-14 13:45'", + "date -s '2018-12-14 13:45'", "systemctl start restic-backups-remotebackup.service", "rm /root/backupCleanupCommand", - "timedatectl set-time '2018-12-15 13:45'", + "date -s '2018-12-15 13:45'", "systemctl start restic-backups-remotebackup.service", "rm /root/backupCleanupCommand", - "timedatectl set-time '2018-12-16 13:45'", + "date -s '2018-12-16 13:45'", "systemctl start restic-backups-remotebackup.service", "rm /root/backupCleanupCommand",