summaryrefslogtreecommitdiffstats
path: root/test/networkd-test.py
diff options
context:
space:
mode:
authorYu Watanabe <watanabe.yu+github@gmail.com>2024-05-24 18:32:21 +0200
committerLuca Boccassi <luca.boccassi@gmail.com>2024-05-25 11:27:19 +0200
commit1ef586af237e685c32676e381a5ce8d4918f9225 (patch)
treecf523982a6757be930ffc59591af2181d3775db3 /test/networkd-test.py
parentMerge pull request #33011 from yuwata/machine-id-setup-follow-ups (diff)
downloadsystemd-1ef586af237e685c32676e381a5ce8d4918f9225.tar.xz
systemd-1ef586af237e685c32676e381a5ce8d4918f9225.zip
test: applying timezone is asynchronous
So, we need to try to read timezone several times. Also, on failure, show journal of timedated instead of hostnamed, as the timezone is handled by timedated. Hopefully fixes #33007.
Diffstat (limited to '')
-rwxr-xr-xtest/networkd-test.py15
1 files changed, 9 insertions, 6 deletions
diff --git a/test/networkd-test.py b/test/networkd-test.py
index 4ea76e1a94..7911c816d7 100755
--- a/test/networkd-test.py
+++ b/test/networkd-test.py
@@ -1053,13 +1053,16 @@ DNS=127.0.0.1
self.create_iface(dhcpserver_opts='EmitTimezone=yes\nTimezone=Pacific/Honolulu')
self.do_test(coldplug=None, extra_opts='IPv6AcceptRA=false\n[DHCP]\nUseTimezone=true', dhcp_mode='ipv4')
- # should have applied the received timezone
- try:
- self.assertEqual(get_tz(), 'Pacific/Honolulu')
- except AssertionError:
+ # Should have applied the received timezone. This is asynchronous, so we need to wait for a while:
+ for _ in range(20):
+ tz = get_tz()
+ if tz == 'Pacific/Honolulu':
+ break
+ time.sleep(0.5)
+ else:
self.show_journal('systemd-networkd.service')
- self.show_journal('systemd-hostnamed.service')
- raise
+ self.show_journal('systemd-timedated.service')
+ self.fail(f'Timezone: {tz}, expected: Pacific/Honolulu')
class MatchClientTest(unittest.TestCase, NetworkdTestingUtilities):