assert 'NTPSynchronized=yes' in 'Timezone=Etc/UTC\nLocalRTC=no\nCanNTP=yes\nNTP=yes\nNTPSynchronized=no\nTimeUSec=Sat 2021-08-21 04:58:09 UTC\nRTCTimeUSec=Sat 2021-08-21 04:58:09 UTC\n'
+ where 'Timezone=Etc/UTC\nLocalRTC=no\nCanNTP=yes\nNTP=yes\nNTPSynchronized=no\nTimeUSec=Sat 2021-08-21 04:58:09 UTC\nRTCTimeUSec=Sat 2021-08-21 04:58:09 UTC\n' = CommandResult(command=b'timedatectl show', exit_status=0, stdout=b'Timezone=Etc/UTC\nLocalRTC=no\nCanNTP=yes\nNTP=yes\...1-08-21 04:58:09 UTC\n', stderr=b"Warning: Permanently added '192.168.121.61' (ECDSA) to the list of known hosts.\r\n").stdout
host = <testinfra.host.Host ansible://app-staging>
def test_system_time(host: Host) -> None:
assert not host.package("ntp").is_installed
assert not host.package("ntpdate").is_installed
s = host.service("systemd-timesyncd")
assert s.is_running
assert s.is_enabled
assert not s.is_masked
# File will be touched on every successful synchronization,
# see 'man systemd-timesyncd'`
assert host.file("/run/systemd/timesync/synchronized").exists
c = host.run("timedatectl show")
assert "NTP=yes" in c.stdout
> assert "NTPSynchronized=yes" in c.stdout
E assert 'NTPSynchronized=yes' in 'Timezone=Etc/UTC\nLocalRTC=no\nCanNTP=yes\nNTP=yes\nNTPSynchronized=no\nTimeUSec=Sat 2021-08-21 04:58:09 UTC\nRTCTimeUSec=Sat 2021-08-21 04:58:09 UTC\n'
E + where 'Timezone=Etc/UTC\nLocalRTC=no\nCanNTP=yes\nNTP=yes\nNTPSynchronized=no\nTimeUSec=Sat 2021-08-21 04:58:09 UTC\nRTCTimeUSec=Sat 2021-08-21 04:58:09 UTC\n' = CommandResult(command=b'timedatectl show', exit_status=0, stdout=b'Timezone=Etc/UTC\nLocalRTC=no\nCanNTP=yes\nNTP=yes\...1-08-21 04:58:09 UTC\n', stderr=b"Warning: Permanently added '192.168.121.61' (ECDSA) to the list of known hosts.\r\n").stdout
../testinfra/common/test_basic_configuration.py:25: AssertionError
So far only observed once in nightly runs: