diff --git a/nixos/tests/timezone.nix b/nixos/tests/timezone.nix index b5d2f6779338..938c6bed9534 100644 --- a/nixos/tests/timezone.nix +++ b/nixos/tests/timezone.nix @@ -44,6 +44,18 @@ print(date_result) assert date_result == "1970-01-01 09:00:00\n", "Timezone was not adjusted" + # Stop systemd-timedated.service to clear /etc/localtime read cache + node_nulltz.systemctl("stop systemd-timedated.service") + timedatectl_result = node_nulltz.succeed("timedatectl status") + print(timedatectl_result) + assert "Asia/Tokyo" in timedatectl_result, "'timedatectl status' output is missing 'Asia/Tokyo'" + + with subtest("imperative - Ensure /etc/localtime symlink includes '/zoneinfo/' like icu expects"): + # https://github.com/unicode-org/icu/blob/release-78.3/icu4c/source/common/putil.cpp#L686-L695 + readlink_result = node_nulltz.succeed("readlink --no-newline /etc/localtime") + print(readlink_result) + assert "/zoneinfo/" in readlink_result, f"/etc/localtime symlink is missing '/zoneinfo/': {readlink_result}" + with subtest("imperative - Ensure timezone adjustment persists across reboot"): # Adjustment should persist across a reboot node_nulltz.shutdown()