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).
Esse commit está contido em:
Marek Marczykowski-Górecki 2020-08-06 03:27:40 +02:00
commit 3815e0b5cf
Nenhuma chave conhecida encontrada para esta assinatura no banco de dados
ID da chave GPG: 063938BA42CFA724

Ver arquivo

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