Skip to content

Commit d281c46

Browse files
author
Pearl Dsilva
committed
marvin: fix test failures when changing service offering of a VM
1 parent 6f96b3b commit d281c46

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
@@ -454,6 +454,30 @@ def test_change_service_offering_for_vm_with_snapshots(self):
454454
self.debug("Stopping VM - ID: %s" % virtual_machine.id)
455455
try:
456456
virtual_machine.stop(self.apiclient)
457+
timeout = self.services["timeout"]
458+
459+
while True:
460+
time.sleep(self.services["sleep"])
461+
462+
# Ensure that VM is in stopped state
463+
list_vm_response = list_virtual_machines(
464+
self.apiclient,
465+
id=virtual_machine.id
466+
)
467+
468+
if isinstance(list_vm_response, list):
469+
470+
vm = list_vm_response[0]
471+
if vm.state == 'Stopped':
472+
self.debug("VM state: %s" % vm.state)
473+
break
474+
475+
if timeout == 0:
476+
raise Exception(
477+
"Failed to stop VM (ID: %s) in change service offering" % vm.id)
478+
479+
timeout = timeout - 1
480+
457481
except Exception as e:
458482
self.fail("Failed to stop VM: %s" % e)
459483

0 commit comments

Comments
 (0)