mirror of
https://github.com/systemd/systemd-stable.git
synced 2025-03-13 12:58:20 +03:00
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. (cherry picked from commit 1ef586af237e685c32676e381a5ce8d4918f9225) (cherry picked from commit 91d31ca3bcf929346ec872d387cd33030d4e1570) (cherry picked from commit 8b86adabd4fe1deb8bf2cb6c51a683eb6581a2af) (cherry picked from commit 64f9ef737417ce60fee711e6eda9aabdc2b4034f)
This commit is contained in:
parent
00f772fdf2
commit
cb40719aa7
@ -1037,13 +1037,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):
|
||||
|
Loading…
x
Reference in New Issue
Block a user