summary refs log tree commit diff
path: root/nixos/tests/systemd.nix
diff options
context:
space:
mode:
authorNaïm Favier <n@monade.li>2021-12-16 04:09:07 +0100
committerNaïm Favier <n@monade.li>2021-12-16 04:09:07 +0100
commit901d4f13a3e30b4f4634c721b5cde6fabcd5405c (patch)
treefd96e9a3469c4c274dfc72cdd878f6c7401ed385 /nixos/tests/systemd.nix
parent988b006652156f21a0dfd47833ba3610e6200d55 (diff)
downloadnixpkgs-901d4f13a3e30b4f4634c721b5cde6fabcd5405c.tar
nixpkgs-901d4f13a3e30b4f4634c721b5cde6fabcd5405c.tar.gz
nixpkgs-901d4f13a3e30b4f4634c721b5cde6fabcd5405c.tar.bz2
nixpkgs-901d4f13a3e30b4f4634c721b5cde6fabcd5405c.tar.lz
nixpkgs-901d4f13a3e30b4f4634c721b5cde6fabcd5405c.tar.xz
nixpkgs-901d4f13a3e30b4f4634c721b5cde6fabcd5405c.tar.zst
nixpkgs-901d4f13a3e30b4f4634c721b5cde6fabcd5405c.zip
nixos/systemd: set TZDIR for PID 1
Fixes #105049
Diffstat (limited to 'nixos/tests/systemd.nix')
-rw-r--r--nixos/tests/systemd.nix12
1 files changed, 12 insertions, 0 deletions
diff --git a/nixos/tests/systemd.nix b/nixos/tests/systemd.nix
index 6561f7efe1a..f86daa5eea9 100644
--- a/nixos/tests/systemd.nix
+++ b/nixos/tests/systemd.nix
@@ -31,6 +31,13 @@ import ./make-test-python.nix ({ pkgs, ... }: {
       umount /tmp/shared
     '';
 
+    systemd.services.oncalendar-test = {
+      description = "calendar test";
+      # Japan does not have DST which makes the test a little bit simpler
+      startAt = "Wed 10:00 Asia/Tokyo";
+      script = "true";
+    };
+
     systemd.services.testservice1 = {
       description = "Test Service 1";
       wantedBy = [ "multi-user.target" ];
@@ -69,6 +76,11 @@ import ./make-test-python.nix ({ pkgs, ... }: {
     # wait for user services
     machine.wait_for_unit("default.target", "alice")
 
+    # Regression test for https://github.com/NixOS/nixpkgs/issues/105049
+    with subtest("systemd reads timezone database in /etc/zoneinfo"):
+        timer = machine.succeed("TZ=UTC systemctl show --property=TimersCalendar oncalendar-test.timer")
+        assert re.search("next_elapse=Wed ....-..-.. 01:00:00 UTC", timer), f"got {timer.strip()}"
+
     # Regression test for https://github.com/NixOS/nixpkgs/issues/35415
     with subtest("configuration files are recognized by systemd"):
         machine.succeed("test -e /system_conf_read")