tests: wait for full user session before doing rest of the test

Clean VM shutdown may timeout if its initiated before full startup, so
make sure the full startup is completed first.
This commit is contained in:
Marek Marczykowski-Górecki 2018-10-27 01:41:30 +02:00
parent 4742a630f2
commit fb14f589cb
No known key found for this signature in database
GPG Key ID: 063938BA42CFA724
3 changed files with 9 additions and 0 deletions

View File

@ -254,6 +254,7 @@ class TC_00_Basic(qubes.tests.SystemTestCase):
try:
# first boot, mkfs private volume
self.loop.run_until_complete(vm.start())
self.loop.run_until_complete(self.wait_for_session(vm))
# get private volume UUID
private_uuid, _ = self.loop.run_until_complete(
vm.run_for_stdio('blkid -o value /dev/xvdb', user='root'))
@ -482,6 +483,7 @@ class TC_03_QvmRevertTemplateChanges(qubes.tests.SystemTestCase):
def _do_test(self):
checksum_before = self.get_rootimg_checksum()
self.loop.run_until_complete(self.test_template.start())
self.loop.run_until_complete(self.wait_for_session(self.test_template))
self.shutdown_and_wait(self.test_template)
checksum_changed = self.get_rootimg_checksum()
if checksum_before == checksum_changed:

View File

@ -77,6 +77,7 @@ class StorageTestMixin(object):
del coro_maybe
self.app.save()
yield from (self.vm1.start())
yield from self.wait_for_session(self.vm1)
# volatile image not clean
yield from (self.vm1.run_for_stdio(
@ -112,6 +113,7 @@ class StorageTestMixin(object):
del coro_maybe
self.app.save()
yield from self.vm1.start()
yield from self.wait_for_session(self.vm1)
# non-volatile image not clean
yield from self.vm1.run_for_stdio(
'head -c {} /dev/zero 2>&1 | diff -q /dev/xvde - 2>&1'.format(size),
@ -197,6 +199,9 @@ class StorageTestMixin(object):
self.app.save()
yield from self.vm1.start()
yield from self.vm2.start()
yield from asyncio.wait(
[self.wait_for_session(self.vm1), self.wait_for_session(self.vm2)])
try:
yield from self.vm1.run_for_stdio(
@ -285,6 +290,7 @@ class StorageTestMixin(object):
del coro_maybe
self.app.save()
yield from self.vm2.start()
yield from self.wait_for_session(self.vm2)
# snapshot image not clean
yield from self.vm2.run_for_stdio(

View File

@ -64,6 +64,7 @@ class TC_00_AppVMMixin(object):
# TODO: wait_for, timeout
self.loop.run_until_complete(self.testvm1.start())
self.assertEqual(self.testvm1.get_power_state(), "Running")
self.loop.run_until_complete(self.wait_for_session(self.testvm1))
self.loop.run_until_complete(self.testvm1.shutdown(wait=True))
self.assertEqual(self.testvm1.get_power_state(), "Halted")