CLOUDSTACK-7205: Adding expunge=True while deleting VM for test case execution speed improvement

This commit is contained in:
Gaurav Aradhye 2014-07-30 03:36:27 -07:00 committed by Girish Shilamkar
parent 291b3ceea5
commit 42a861e590
12 changed files with 30 additions and 81 deletions

View File

@ -317,13 +317,11 @@ class TestBrocadeVcs(cloudstackTestCase):
)
# Deleting a single VM
VirtualMachine.delete(virtual_machine_1, self.apiclient)
VirtualMachine.expung(virtual_machine_1, self.apiclient)
VirtualMachine.delete(virtual_machine_1, self.apiclient, expunge=True)
# Deleting a single VM
VirtualMachine.delete(virtual_machine_2, self.apiclient)
VirtualMachine.expung(virtual_machine_2, self.apiclient)
VirtualMachine.delete(virtual_machine_2, self.apiclient, expunge=True)
# Delete Network

View File

@ -797,37 +797,9 @@ class TestEIP(cloudstackTestCase):
))
self.debug("Destroying an instance: %s" % self.virtual_machine.name)
self.virtual_machine.delete(self.apiclient)
self.virtual_machine.delete(self.apiclient, expunge=True)
self.debug("Destroy instance complete!")
config = list_configurations(
self.apiclient,
name='expunge.delay'
)
self.assertEqual(
isinstance(config, list),
True,
"Check list configurations response"
)
exp_delay = config[0]
self.debug("expunge.delay: %s" % exp_delay.value)
config = list_configurations(
self.apiclient,
name='expunge.interval'
)
self.assertEqual(
isinstance(config, list),
True,
"Check list configurations response"
)
exp_interval = config[0]
self.debug("expunge.interval: %s" % exp_interval.value)
# wait for exp_delay+exp_interval - cleans up VM
total_wait = int(exp_interval.value) + int(exp_delay.value)
time.sleep(total_wait)
vms = VirtualMachine.list(
self.apiclient,
id=self.virtual_machine.id

View File

@ -1013,7 +1013,7 @@ class TestNetworks_1(cloudstackTestCase):
)
instance_page2 = list_instances_page2[0]
# Deleting a single VM
VirtualMachine.delete(vm_created, self.userapiclient)
VirtualMachine.delete(vm_created, self.userapiclient, expunge=True)
# Listing the VM's in page 2
list_instance_response = VirtualMachine.list(
self.userapiclient,

View File

@ -965,10 +965,7 @@ class TestVmNetworkOperations(cloudstackTestCase):
network.id, vmguestip=ipaddress_2.ipaddress)
# Delete VM
virtual_machine.delete(self.apiclient)
# Wait for VMs to expunge
wait_for_cleanup(self.api_client, ["expunge.delay", "expunge.interval"])
virtual_machine.delete(self.apiclient, expunge=True)
# Make sure the VM is expunged
retriesCount = 20

View File

@ -301,10 +301,10 @@ class TestNuageVsp(cloudstackTestCase):
"VM state should be running after deployment"
)
VirtualMachine.delete(virtual_machine_1, self.apiclient)
VirtualMachine.delete(virtual_machine_1, self.apiclient, expunge=True)
# Deleting a single VM
VirtualMachine.delete(virtual_machine_2, self.apiclient)
VirtualMachine.delete(virtual_machine_2, self.apiclient, expunge=True)
# Delete Network
Network.delete(self.network, self.apiclient)

View File

@ -164,7 +164,7 @@ class TestPersistentNetworks(cloudstackTestCase):
"""verify if vm is expunged"""
isVmExpunged = False
try:
virtual_machine.delete(self.apiclient)
virtual_machine.delete(self.apiclient, expunge=True)
except Exception as e:
self.fail("Failed to delete VM: %s with error %s" % (virtual_machine.id, e))
@ -232,7 +232,7 @@ class TestPersistentNetworks(cloudstackTestCase):
virtual_machine = VirtualMachine.create(self.apiclient,self.services["virtual_machine"],
networkids=[network.id],serviceofferingid=self.service_offering.id,
accountid=self.account.name,domainid=self.domain.id)
virtual_machine.delete(self.apiclient)
virtual_machine.delete(self.apiclient, expunge=True)
except Exception as e:
self.fail("vm creation failed: %s" % e)
@ -378,7 +378,7 @@ class TestPersistentNetworks(cloudstackTestCase):
self.fail("Exception while SSHing to VM %s with IP %s" % (virtual_machine.id, ipaddress.ipaddress.ipaddress))
# Delete VM
virtual_machine.delete(self.api_client)
virtual_machine.delete(self.api_client, expunge=True)
# Verify VM is expunged
self.verifyVmExpungement(virtual_machine)
@ -457,7 +457,7 @@ class TestPersistentNetworks(cloudstackTestCase):
except Exception as e:
self.fail("Exception while SSHing to VM %s with IP %s" % (virtual_machine.id, ipaddress.ipaddress.ipaddress))
virtual_machine.delete(self.api_client)
virtual_machine.delete(self.api_client, expunge=True)
# Verify VM is expunged
self.verifyVmExpungement(virtual_machine)
@ -540,7 +540,7 @@ class TestPersistentNetworks(cloudstackTestCase):
except Exception as e:
self.fail("Exception while SSHing to VM %s with IP %s" % (virtual_machine.id, ipaddress.ipaddress.ipaddress))
virtual_machine.delete(self.api_client)
virtual_machine.delete(self.api_client, expunge=True)
# Verify VM is expunged
self.verifyVmExpungement(virtual_machine)
@ -919,7 +919,7 @@ class TestPersistentNetworks(cloudstackTestCase):
self.fail("Exception while SSHing to VM %s with IP %s" % (virtual_machine.id, ipaddress.ipaddress.ipaddress))
# Delete VM
virtual_machine.delete(self.api_client)
virtual_machine.delete(self.api_client, expunge=True)
# Verify VM is expunged
self.verifyVmExpungement(virtual_machine)

View File

@ -534,10 +534,7 @@ class TestNetwork(cloudstackTestCase):
)
# Delete VM before network gets deleted in cleanup
virtual_machine.delete(self.apiclient)
# Wait for expunge interval to cleanup VM
wait_for_cleanup(self.apiclient, ["expunge.delay", "expunge.interval"])
virtual_machine.delete(self.apiclient, expunge=True)
return

View File

@ -227,7 +227,7 @@ class TestVmUsage(cloudstackTestCase):
try:
# Destroy the VM
self.debug("Destroying the VM: %s" % self.virtual_machine.id)
self.virtual_machine.delete(self.apiclient)
self.virtual_machine.delete(self.apiclient, expunge=True)
except Exception as e:
self.fail("Failed to delete VM: %s" % e)

View File

@ -218,7 +218,7 @@ class TestResetSSHKeypair(cloudstackTestCase):
)
cls._cleanup.append(cls.pw_ssh_enabled_template)
# Delete the VM - No longer needed
cls.virtual_machine.delete(cls.api_client)
cls.virtual_machine.delete(cls.api_client, expunge=True)
except Exception as e:
cls.tearDownClass()
raise unittest.SkipTest("Exception in setUpClass: %s" % e)
@ -359,7 +359,7 @@ class TestResetSSHKeypair(cloudstackTestCase):
except Exception as e:
self.fail("Failed to SSH into VM with new keypair: %s, %s" %
(virtual_machine.name, e))
virtual_machine.delete(self.apiclient)
virtual_machine.delete(self.apiclient, expunge=True)
return
@attr(tags=["simulator", "basic", "advanced"])
@ -477,7 +477,7 @@ class TestResetSSHKeypair(cloudstackTestCase):
except Exception as e:
self.fail("Failed to SSH into VM with password: %s, %s" %
(virtual_machine.name, e))
virtual_machine.delete(self.apiclient)
virtual_machine.delete(self.apiclient, expunge=True)
return
@attr(tags=["simulator", "basic", "advanced"])
@ -580,7 +580,7 @@ class TestResetSSHKeypair(cloudstackTestCase):
except Exception as e:
self.fail("Failed to SSH into VM with new keypair: %s, %s" %
(virtual_machine.name, e))
virtual_machine.delete(self.apiclient)
virtual_machine.delete(self.apiclient, expunge=True)
return
@attr(tags=["simulator", "basic", "advanced"])
@ -691,7 +691,7 @@ class TestResetSSHKeypair(cloudstackTestCase):
except Exception as e:
self.fail("Failed to SSH into VM with new keypair: %s, %s" %
(virtual_machine.name, e))
virtual_machine.delete(self.apiclient)
virtual_machine.delete(self.apiclient, expunge=True)
return
@attr(tags=["simulator", "basic", "advanced"])
@ -766,7 +766,7 @@ class TestResetSSHKeypair(cloudstackTestCase):
domainid=self.account.domainid
)
virtual_machine.delete(self.apiclient)
virtual_machine.delete(self.apiclient, expunge=True)
return
@attr(tags=["simulator", "basic", "advanced"])
@ -844,7 +844,7 @@ class TestResetSSHKeypair(cloudstackTestCase):
domainid=self.account.domainid
)
virtual_machine.delete(self.apiclient)
virtual_machine.delete(self.apiclient, expunge=True)
return
@attr(tags=["simulator", "basic", "advanced"])
@ -920,7 +920,7 @@ class TestResetSSHKeypair(cloudstackTestCase):
)
self.debug("Reset SSH key pair failed due to invalid parameters")
virtual_machine.delete(self.apiclient)
virtual_machine.delete(self.apiclient, expunge=True)
return
class TestResetSSHKeyUserRights(cloudstackTestCase):
@ -1030,7 +1030,7 @@ class TestResetSSHKeyUserRights(cloudstackTestCase):
cls.volume.id
)
# Delete the VM - No longer needed
cls.virtual_machine.delete(cls.api_client)
cls.virtual_machine.delete(cls.api_client, expunge=True)
cls._cleanup = [
cls.service_offering,
@ -1184,7 +1184,7 @@ class TestResetSSHKeyUserRights(cloudstackTestCase):
self.fail("Failed to SSH into VM with new keypair: %s, %s" %
(virtual_machine.name, e))
virtual_machine.delete(self.apiclient)
virtual_machine.delete(self.apiclient, expunge=True)
return
@attr(tags=["simulator", "basic", "advanced"])
@ -1323,7 +1323,7 @@ class TestResetSSHKeyUserRights(cloudstackTestCase):
self.fail("Failed to SSH into VM with new keypair: %s, %s" %
(virtual_machine.name, e))
virtual_machine.delete(self.apiclient)
virtual_machine.delete(self.apiclient, expunge=True)
return
@attr(tags=["simulator", "basic", "advanced"])
@ -1462,5 +1462,5 @@ class TestResetSSHKeyUserRights(cloudstackTestCase):
except Exception as e:
self.fail("Failed to SSH into VM with new keypair: %s, %s" %
(virtual_machine.name, e))
virtual_machine.delete(self.apiclient)
virtual_machine.delete(self.apiclient, expunge=True)
return

View File

@ -1207,23 +1207,8 @@ class TestDeleteSecurityGroup(cloudstackTestCase):
self.debug("Deploying VM in account: %s" % self.account.name)
# Destroy the VM
self.virtual_machine.delete(self.apiclient)
self.virtual_machine.delete(self.apiclient, expunge=True)
config = Configurations.list(
self.apiclient,
name='expunge.delay'
)
self.assertEqual(
isinstance(config, list),
True,
"Check list configurations response"
)
response = config[0]
self.debug("expunge.delay: %s" % response.value)
# Wait for some time more than expunge.delay
time.sleep(int(response.value) * 2)
# Deleting Security group should raise exception
try:
self.debug("Deleting Security Group: %s" % security_group.id)
security_group.delete(self.apiclient)

View File

@ -214,7 +214,7 @@ class TestVmUsage(cloudstackTestCase):
try:
# Destroy the VM
self.debug("Destroying the VM: %s" % self.virtual_machine.id)
self.virtual_machine.delete(self.apiclient)
self.virtual_machine.delete(self.apiclient, expunge=True)
except Exception as e:
self.fail("Failed to destroy VM: %s" % e)

View File

@ -208,7 +208,7 @@ class TestVMPasswordEnabled(cloudstackTestCase):
domainid=cls.account.domainid
)
# Delete the VM - No longer needed
cls.virtual_machine.delete(cls.api_client)
cls.virtual_machine.delete(cls.api_client, expunge=True)
cls.services["small"]["template"] = cls.pw_enabled_template.id
cls.vm = VirtualMachine.create(