Skip to content

Commit

Permalink
tests: make qvm-sync-clock test more reliable
Browse files Browse the repository at this point in the history
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).

(cherry picked from commit 3815e0b)
  • Loading branch information
marmarek committed Oct 22, 2020
1 parent 117947d commit a742e75
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions qubes/tests/integ/vm_qrexec_gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -399,10 +399,13 @@ def test_210_time_sync(self):
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
Expand Down

0 comments on commit a742e75

Please sign in to comment.