tests: fix startup timeout and looking for logs

On OpenQA 20 isn't enough to start a VM. Also make sure previous
shutdown has finished by using qvm-shutdown --wait.

VM needs to be started at least once to have active "logs" submenu. For
this reason, choose a running VM.
This commit is contained in:
Marek Marczykowski-Górecki 2019-12-04 21:05:45 +01:00
parent 99ab388597
commit ffcfb4e7cf
No known key found for this signature in database
GPG Key ID: 063938BA42CFA724

View File

@ -1084,9 +1084,9 @@ class QubeManagerTest(unittest.TestCase):
self.addCleanup( self.addCleanup(
subprocess.call, subprocess.call,
["qvm-shutdown", target_vm_name]) ["qvm-shutdown", "--wait", target_vm_name])
self._run_command_and_process_events( self._run_command_and_process_events(
["qvm-start", target_vm_name], timeout=20) ["qvm-start", target_vm_name], timeout=60)
status_item = self._get_table_item(vm_row, "State") status_item = self._get_table_item(vm_row, "State")
@ -1096,7 +1096,7 @@ class QubeManagerTest(unittest.TestCase):
"Power state failed to update on start") "Power state failed to update on start")
self._run_command_and_process_events( self._run_command_and_process_events(
["qvm-shutdown", target_vm_name], timeout=20) ["qvm-shutdown", "--wait", target_vm_name], timeout=30)
displayed_power_state = status_item.on_icon.status displayed_power_state = status_item.on_icon.status
@ -1122,9 +1122,9 @@ class QubeManagerTest(unittest.TestCase):
self.addCleanup( self.addCleanup(
subprocess.call, subprocess.call,
["qvm-shutdown", target_vm_name]) ["qvm-shutdown", "--wait", target_vm_name])
self._run_command_and_process_events( self._run_command_and_process_events(
["qvm-start", target_vm_name], timeout=20) ["qvm-start", target_vm_name], timeout=60)
for i in range(self.dialog.table.rowCount()): for i in range(self.dialog.table.rowCount()):
call_count = self._get_table_item( call_count = self._get_table_item(
@ -1149,7 +1149,7 @@ class QubeManagerTest(unittest.TestCase):
self.assertIn("hypervisor", c.text(), self.assertIn("hypervisor", c.text(),
"Log for dom0 does not contain 'hypervisor'") "Log for dom0 does not contain 'hypervisor'")
selected_vm = self._select_non_admin_vm().name selected_vm = self._select_non_admin_vm(running=True).name
self.assertTrue(self.dialog.logs_menu.isEnabled()) self.assertTrue(self.dialog.logs_menu.isEnabled())