tests: minor fixes to time sync tests

- don't crash when ClockVM wasn't set previously
- increase allowed delta (for slow systems)
This commit is contained in:
Marek Marczykowski-Górecki 2015-11-03 02:46:03 +01:00
parent 31ad72aa70
commit c30c9c7d4e
No known key found for this signature in database
GPG Key ID: 063938BA42CFA724

View File

@ -611,7 +611,11 @@ class TC_00_AppVMMixin(qubes.tests.SystemTestsMixin):
self.testvm2.start()
(start_time, _) = subprocess.Popen(["date", "-u", "+%s"],
stdout=subprocess.PIPE).communicate()
original_clockvm_name = self.qc.get_clockvm_vm().name
original_clockvm = self.qc.get_clockvm_vm()
if original_clockvm:
original_clockvm_name = original_clockvm.name
else:
original_clockvm_name = "none"
try:
# use qubes-prefs to not hassle with qubes.xml locking
subprocess.check_call(["qubes-prefs", "-s", "clockvm",
@ -639,7 +643,7 @@ class TC_00_AppVMMixin(qubes.tests.SystemTestsMixin):
(dom0_time, _) = subprocess.Popen(["date", "-u", "+%s"],
stdout=subprocess.PIPE
).communicate()
self.assertAlmostEquals(int(dom0_time), int(start_time), delta=10)
self.assertAlmostEquals(int(dom0_time), int(start_time), delta=30)
except:
# reset time to some approximation of the real time