nixos/tests/timezone: extend to test systemd /etc/timezone regression

This should help to catch the regression described in 2fb95a568c
if it ever does end up resurfacing.

Please see that commit for more details on this.

The tl;dr is: At the very least systemd and icu::TimeZone both make
assumptions about how the /etc/localtime symlink they read should look
like. In one of our systemd patches, we broke this for both itself and
icu::TimeZone. And while we could extend our systemd patch, we cannot as
easily patch icu and we don't know who else makes similar assumptions.
This commit is contained in:
emilylange 2026-04-04 05:07:59 +02:00
commit 4268e25679
No known key found for this signature in database
GPG key ID: 0AD773CE46FD0F87

View file

@ -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()