From c8f744dbc36b192620c8b494cc41cfb18e1d81be Mon Sep 17 00:00:00 2001 From: Prasanna Santhanam Date: Wed, 19 Jun 2013 17:05:24 +0530 Subject: [PATCH] Prevent waits at cleanup Do not wait until gc finishes cleanup of resources. This delays tests and is dependant on the deployment. Some have large cleanup.intervals. Assume cleanup succeeds and proceed Signed-off-by: Prasanna Santhanam --- .../component/test_vpc_offerings.py | 52 ++++--------------- 1 file changed, 11 insertions(+), 41 deletions(-) diff --git a/test/integration/component/test_vpc_offerings.py b/test/integration/component/test_vpc_offerings.py index a111d7d9059..cf37d907d5e 100644 --- a/test/integration/component/test_vpc_offerings.py +++ b/test/integration/component/test_vpc_offerings.py @@ -130,7 +130,6 @@ class Services: # Cent OS 5.3 (64 bit) "sleep": 60, "timeout": 10, - "mode": 'advanced' } @@ -181,36 +180,7 @@ class TestVPCOffering(cloudstackTestCase): admin=True, domainid=self.domain.id ) - self.cleanup = [] - return - - def tearDown(self): - try: - #Clean up, terminate the created network offering - self.account.delete(self.apiclient) - interval = list_configurations( - self.apiclient, - name='network.gc.interval' - ) - wait = list_configurations( - self.apiclient, - name='network.gc.wait' - ) - # Sleep to ensure that all resources are deleted - time.sleep(int(interval[0].value) + int(wait[0].value)) - cleanup_resources(self.apiclient, self.cleanup) - interval = list_configurations( - self.apiclient, - name='network.gc.interval' - ) - wait = list_configurations( - self.apiclient, - name='network.gc.wait' - ) - # Sleep to ensure that all resources are deleted - time.sleep(int(interval[0].value) + int(wait[0].value)) - except Exception as e: - raise Exception("Warning: Exception during cleanup : %s" % e) + self._cleanup.insert(0, self.account) return def validate_vpc_offering(self, vpc_offering): @@ -273,7 +243,7 @@ class TestVPCOffering(cloudstackTestCase): ) self.debug("Check if the VPC offering is created successfully?") - self.cleanup.append(vpc_off) + self._cleanup.append(vpc_off) self.validate_vpc_offering(vpc_off) return @@ -581,7 +551,7 @@ class TestVPCOffering(cloudstackTestCase): self.services["vpc_offering"] ) - self.cleanup.append(vpc_off) + self._cleanup.append(vpc_off) self.validate_vpc_offering(vpc_off) self.debug("Enabling the VPC offering created") @@ -700,7 +670,7 @@ class TestVPCOffering(cloudstackTestCase): self.services["vpc_offering"] ) - self.cleanup.append(vpc_off) + self._cleanup.append(vpc_off) self.validate_vpc_offering(vpc_off) self.debug("Enabling the VPC offering created") @@ -821,7 +791,7 @@ class TestVPCOffering(cloudstackTestCase): self.services["vpc_offering"] ) - self.cleanup.append(vpc_off) + self._cleanup.append(vpc_off) self.validate_vpc_offering(vpc_off) self.debug("Enabling the VPC offering created") @@ -934,7 +904,7 @@ class TestVPCOffering(cloudstackTestCase): ) self.validate_vpc_offering(vpc_off) # Appending to cleanup to delete after test - self.cleanup.append(vpc_off) + self._cleanup.append(vpc_off) except Exception as e: self.fail("Failed to create the VPC offering - %s" % e) return @@ -958,7 +928,7 @@ class TestVPCOffering(cloudstackTestCase): self.services["vpc_offering"] ) - self.cleanup.append(vpc_off) + self._cleanup.append(vpc_off) self.validate_vpc_offering(vpc_off) self.debug("Enabling the VPC offering created") @@ -1054,7 +1024,7 @@ class TestVPCOffering(cloudstackTestCase): self.apiclient, self.services["vpc_offering"] ) - self.cleanup.append(vpc_off_1) + self._cleanup.append(vpc_off_1) self.validate_vpc_offering(vpc_off_1) self.debug("Disabling the VPC offering created") vpc_off_1.update(self.apiclient, state='Disabled') @@ -1064,7 +1034,7 @@ class TestVPCOffering(cloudstackTestCase): self.services["vpc_offering"] ) - self.cleanup.append(vpc_off_2) + self._cleanup.append(vpc_off_2) self.validate_vpc_offering(vpc_off_2) self.debug("Enabling the VPC offering created") vpc_off_2.update(self.apiclient, state='Enabled') @@ -1074,7 +1044,7 @@ class TestVPCOffering(cloudstackTestCase): self.services["vpc_offering"] ) - self.cleanup.append(vpc_off_3) + self._cleanup.append(vpc_off_3) self.validate_vpc_offering(vpc_off_3) self.debug("Enabling the VPC offering created") vpc_off_3.update(self.apiclient, state='Enabled') @@ -1083,7 +1053,7 @@ class TestVPCOffering(cloudstackTestCase): self.apiclient, self.services["vpc_offering"] ) - self.validate_vpc_offering(vpc_off_4) + self._cleanup.append(vpc_off_4) self.debug("Enabling the VPC offering created") vpc_off_4.update(self.apiclient, state='Enabled')