diff --git a/tests/test_ntp.py b/tests/test_ntp.py index a23ceda52000c6ff7c4d50a05ecc43ee8f0cc63d..b703bb433966dd9c0421e880e2a6efcb323516d8 100755 --- a/tests/test_ntp.py +++ b/tests/test_ntp.py @@ -11,10 +11,17 @@ import subprocess import imp # Check that ntpd is synced -print('Running ntpq -pd') -ntpd_status = subprocess.getoutput('LANG=C ntpq -pd') -if 'remote' not in ntpd_status: - print('NTP not working, ntpq -p output:\n%s' % ntpd_status) +if os.path.isfile('/usr/bin/ntpq'): + cmd = "LANG=C ntpq -pd" + expected = "remote" +else: + cmd = "LANG=C timedatectl" + expected = 'NTP synchronized' + +print("Running %s" % cmd) +status = subprocess.getoutput(cmd) +if expected not in status: + print('NTP not working: %s' % status) sys.exit(1) else: print('System is NTP synchronized')