Skip to content

Commit

Permalink
tests: wait for full user session before doing rest of the test
Browse files Browse the repository at this point in the history
Clean VM shutdown may timeout if its initiated before full startup, so
make sure the full startup is completed first.
  • Loading branch information
marmarek committed Oct 27, 2018
1 parent 4742a63 commit fb14f58
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 0 deletions.
2 changes: 2 additions & 0 deletions qubes/tests/integ/basic.py
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,7 @@ def assertVolumesExcludedFromUdev(self, vm):
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'))
Expand Down Expand Up @@ -482,6 +483,7 @@ def get_rootimg_checksum(self):
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:
Expand Down
6 changes: 6 additions & 0 deletions qubes/tests/integ/storage.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ def _test_000_volatile(self):
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(
Expand Down Expand Up @@ -112,6 +113,7 @@ def _test_001_non_volatile(self):
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),
Expand Down Expand Up @@ -197,6 +199,9 @@ def _test_003_snapshot(self):
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(
Expand Down Expand Up @@ -285,6 +290,7 @@ def _test_004_snapshot_non_persistent(self):
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(
Expand Down
1 change: 1 addition & 0 deletions qubes/tests/integ/vm_qrexec_gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ def test_000_start_shutdown(self):
# 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")

Expand Down

0 comments on commit fb14f58

Please sign in to comment.