Improve DisruptTripleoNodesTest tearDown
This tearDown is only executed when test_z99_reboot_controller_galera_main_vip test is run. It tries to delete the group of VMs created for this test, whose names have a common pattern: "group_of_vms_%d" % i Sometimes the vms_detailed_info variable does not contain all the existing VM IDs and, due to this, some of the VMs are not deleted. With this patch, whenever vms_detailed_info does not include the ID for some VM, the tearDown method will search for it using its VM name. Change-Id: Id7b2e4cc0d7b0e9deb7a8865f9c891de3f38260f
This commit is contained in:
parent
27c9879c4b
commit
45600a7bb3
@ -206,14 +206,25 @@ class DisruptTripleoNodesTest(testtools.TestCase):
|
||||
|
||||
def tearDown(self):
|
||||
super(DisruptTripleoNodesTest, self).tearDown()
|
||||
for vm in self.vms_detailed_info or []:
|
||||
for i, vm in enumerate(self.vms_detailed_info or []):
|
||||
if vm is None or vm.get('id') is None:
|
||||
continue
|
||||
vm_id = vm['id']
|
||||
# server_name pattern comes from multi_ip_test_stack.yaml
|
||||
server_name = "group_of_vms_%d" % i
|
||||
try:
|
||||
server = nova_osp.find_server(unique=True,
|
||||
name=server_name)
|
||||
except tobiko.ObjectNotFound:
|
||||
LOG.debug(f"Server {server_name} not found. "
|
||||
"Perhaps it was never created.")
|
||||
continue
|
||||
vm_id = server.id
|
||||
else:
|
||||
vm_id = vm['id']
|
||||
try:
|
||||
nova_osp.delete_server(vm_id)
|
||||
except nova_osp.ServerNotFoundError:
|
||||
LOG.debug(f"Server {vm_id} not found")
|
||||
LOG.debug(f"Server {vm_id} not found. "
|
||||
"Perhaps it was already deleted.")
|
||||
|
||||
@testtools.skipIf(has_external_lb, SKIP_MESSAGE_EXTLB)
|
||||
def test_z99_reboot_controller_galera_main_vip(self):
|
||||
|
Loading…
Reference in New Issue
Block a user