Skip to content

Commit 75fab3e

Browse files
author
Pearl Dsilva
committed
marvin: fix test failures when changing service offering of a virtual machine
1 parent ff376d8 commit 75fab3e

File tree

2 files changed

+41
-0
lines changed

2 files changed

+41
-0
lines changed

test/integration/smoke/test_service_offerings.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -502,6 +502,23 @@ def test_04_change_offering_small(self):
502502
self.skipTest("Skipping this test for {} due to bug CS-38153".format(self.hypervisor))
503503
try:
504504
self.medium_virtual_machine.stop(self.apiclient)
505+
timeout = self.services["timeout"]
506+
while True:
507+
time.sleep(self.services["sleep"])
508+
# Ensure that VM is in stopped state
509+
list_vm_response = list_virtual_machines(
510+
self.apiclient,
511+
id=self.medium_virtual_machine.id
512+
)
513+
if isinstance(list_vm_response, list):
514+
vm = list_vm_response[0]
515+
if vm.state == 'Stopped':
516+
self.debug("VM state: %s" % vm.state)
517+
break
518+
if timeout == 0:
519+
raise Exception(
520+
"Failed to stop VM (ID: %s) in change service offering" % vm.id)
521+
timeout = timeout - 1
505522
except Exception as e:
506523
self.fail("Failed to stop VM: %s" % e)
507524

test/integration/smoke/test_vm_snapshots.py

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -457,6 +457,30 @@ def test_change_service_offering_for_vm_with_snapshots(self):
457457
self.debug("Stopping VM - ID: %s" % virtual_machine.id)
458458
try:
459459
virtual_machine.stop(self.apiclient)
460+
timeout = self.services["timeout"]
461+
462+
while True:
463+
time.sleep(self.services["sleep"])
464+
465+
# Ensure that VM is in stopped state
466+
list_vm_response = list_virtual_machines(
467+
self.apiclient,
468+
id=virtual_machine.id
469+
)
470+
471+
if isinstance(list_vm_response, list):
472+
473+
vm = list_vm_response[0]
474+
if vm.state == 'Stopped':
475+
self.debug("VM state: %s" % vm.state)
476+
break
477+
478+
if timeout == 0:
479+
raise Exception(
480+
"Failed to stop VM (ID: %s) in change service offering" % vm.id)
481+
482+
timeout = timeout - 1
483+
460484
except Exception as e:
461485
self.fail("Failed to stop VM: %s" % e)
462486

0 commit comments

Comments
 (0)