tests: make qvm-sync-clock test more reliable

Compare the time with the "current" time retrieved from ClockVM just
before comparing, not with the test start time. This should work even if
the test machine is quite slow (test taking more than 30s).
This commit is contained in:
Marek Marczykowski-Górecki 2020-08-06 03:27:40 +02:00
parent 4acf69e8ec
commit 3815e0b5cf
No known key found for this signature in database
GPG Key ID: 063938BA42CFA724

View File

@ -399,10 +399,13 @@ class TC_00_AppVMMixin(object):
self.assertEqual(p.returncode, 0)
vm_time, _ = self.loop.run_until_complete(
self.testvm2.run_for_stdio('date -u +%s'))
self.assertAlmostEquals(int(vm_time), int(start_time), delta=30)
# get current time
current_time, _ = self.loop.run_until_complete(
self.testvm1.run_for_stdio('date -u +%s'))
self.assertAlmostEquals(int(vm_time), int(current_time), delta=30)
dom0_time = subprocess.check_output(['date', '-u', '+%s'])
self.assertAlmostEquals(int(dom0_time), int(start_time), delta=30)
self.assertAlmostEquals(int(dom0_time), int(current_time), delta=30)
except:
# reset time to some approximation of the real time