Browse Source

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).
Marek Marczykowski-Górecki 3 years ago
parent
commit
3815e0b5cf
1 changed files with 5 additions and 2 deletions
  1. 5 2
      qubes/tests/integ/vm_qrexec_gui.py

+ 5 - 2
qubes/tests/integ/vm_qrexec_gui.py

@@ -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