Updated Branches: refs/heads/master f486d36f8 -> 16c3d21ee
Automation: add object to cleanup set immediately after creation Otherwise it's possible that the later failure would prevent the object from been clean up. Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/16c3d21e Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/16c3d21e Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/16c3d21e Branch: refs/heads/master Commit: 16c3d21eec8ccd83afb1634d6820cf490b6f7bb9 Parents: f486d36 Author: Sheng Yang <sheng.y...@citrix.com> Authored: Mon Jul 29 17:14:27 2013 -0700 Committer: Sheng Yang <sheng.y...@citrix.com> Committed: Mon Jul 29 17:15:34 2013 -0700 ---------------------------------------------------------------------- .../component/test_redundant_router.py | 37 ++++++++------------ test/integration/component/test_vpc_network.py | 32 ++++++++--------- 2 files changed, 29 insertions(+), 40 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/16c3d21e/test/integration/component/test_redundant_router.py ---------------------------------------------------------------------- diff --git a/test/integration/component/test_redundant_router.py b/test/integration/component/test_redundant_router.py index 7466819..d77b84d 100644 --- a/test/integration/component/test_redundant_router.py +++ b/test/integration/component/test_redundant_router.py @@ -247,22 +247,22 @@ class TestCreateRvRNetwork(cloudstackTestCase): cls.services["virtual_machine"]["zoneid"] = cls.zone.id cls.services["virtual_machine"]["template"] = cls.template.id + cls._cleanup = [] cls.service_offering = ServiceOffering.create( cls.api_client, cls.services["service_offering"] ) + cls._cleanup.append(cls.service_offering) cls.network_offering = NetworkOffering.create( cls.api_client, cls.services["network_offering"], conservemode=True ) + cls._cleanup.append(cls.network_offering) + # Enable Network offering cls.network_offering.update(cls.api_client, state='Enabled') - cls._cleanup = [ - cls.service_offering, - cls.network_offering, - ] return @classmethod @@ -449,22 +449,20 @@ class TestCreateRvRNetworkNonDefaultGuestCidr(cloudstackTestCase): cls.services["virtual_machine"]["zoneid"] = cls.zone.id cls.services["virtual_machine"]["template"] = cls.template.id + cls._cleanup = [] cls.service_offering = ServiceOffering.create( cls.api_client, cls.services["service_offering"] ) + cls._cleanup.append(cls.service_offering) cls.network_offering = NetworkOffering.create( cls.api_client, cls.services["network_offering"], conservemode=True ) + cls._cleanup.append(cls.network_offering) # Enable Network offering cls.network_offering.update(cls.api_client, state='Enabled') - - cls._cleanup = [ - cls.service_offering, - cls.network_offering, - ] return @classmethod @@ -660,22 +658,20 @@ class TestRVRInternals(cloudstackTestCase): cls.services["virtual_machine"]["zoneid"] = cls.zone.id cls.services["virtual_machine"]["template"] = cls.template.id + cls._cleanup = [] cls.service_offering = ServiceOffering.create( cls.api_client, cls.services["service_offering"] ) + cls._cleanup.append(cls.service_offering) cls.network_offering = NetworkOffering.create( cls.api_client, cls.services["network_offering"], conservemode=True ) + cls._cleanup.append(cls.network_offering) # Enable Network offering cls.network_offering.update(cls.api_client, state='Enabled') - - cls._cleanup = [ - cls.service_offering, - cls.network_offering, - ] return @classmethod @@ -965,22 +961,20 @@ class TestRvRRedundancy(cloudstackTestCase): cls.services["virtual_machine"]["zoneid"] = cls.zone.id cls.services["virtual_machine"]["template"] = cls.template.id + cls._cleanup = [] cls.service_offering = ServiceOffering.create( cls.api_client, cls.services["service_offering"] ) + cls._cleanup.append(cls.service_offering) cls.network_offering = NetworkOffering.create( cls.api_client, cls.services["network_offering"], conservemode=True ) + cls._cleanup.append(cls.network_offering) # Enable Network offering cls.network_offering.update(cls.api_client, state='Enabled') - - cls._cleanup = [ - cls.service_offering, - cls.network_offering, - ] return @classmethod @@ -995,12 +989,14 @@ class TestRvRRedundancy(cloudstackTestCase): def setUp(self): self.apiclient = self.testClient.getApiClient() self.dbclient = self.testClient.getDbConnection() + self.cleanup = [] self.account = Account.create( self.apiclient, self.services["account"], admin=True, domainid=self.domain.id ) + self.cleanup.insert(0, self.account) # Creating network using the network offering created self.debug("Creating network with network offering: %s" % self.network_offering.id) @@ -1028,9 +1024,6 @@ class TestRvRRedundancy(cloudstackTestCase): # wait for VR to update state time.sleep(self.services["sleep"]) - - self.cleanup = [] - self.cleanup.insert(0, self.account) return def tearDown(self): http://git-wip-us.apache.org/repos/asf/cloudstack/blob/16c3d21e/test/integration/component/test_vpc_network.py ---------------------------------------------------------------------- diff --git a/test/integration/component/test_vpc_network.py b/test/integration/component/test_vpc_network.py index 517751c..03ff71e 100644 --- a/test/integration/component/test_vpc_network.py +++ b/test/integration/component/test_vpc_network.py @@ -193,19 +193,18 @@ class TestVPCNetwork(cloudstackTestCase): cls.services["virtual_machine"]["zoneid"] = cls.zone.id cls.services["virtual_machine"]["template"] = cls.template.id + cls._cleanup = [] cls.service_offering = ServiceOffering.create( cls.api_client, cls.services["service_offering"] ) + cls._cleanup.append(cls.service_offering) cls.vpc_off = VpcOffering.create( cls.api_client, cls.services["vpc_offering"] ) + cls._cleanup.append(cls.vpc_off) cls.vpc_off.update(cls.api_client, state='Enabled') - cls._cleanup = [ - cls.service_offering, - cls.vpc_off - ] return @classmethod @@ -1051,19 +1050,18 @@ class TestVPCNetworkRanges(cloudstackTestCase): cls.services["virtual_machine"]["zoneid"] = cls.zone.id cls.services["virtual_machine"]["template"] = cls.template.id + cls._cleanup = [] cls.service_offering = ServiceOffering.create( cls.api_client, cls.services["service_offering"] ) + cls._cleanup.append(cls.service_offering) cls.vpc_off = VpcOffering.create( cls.api_client, cls.services["vpc_offering"] ) cls.vpc_off.update(cls.api_client, state='Enabled') - cls._cleanup = [ - cls.service_offering, - cls.vpc_off - ] + cls._cleanup.append(cls.vpc_off) return @classmethod @@ -1555,19 +1553,18 @@ class TestVPCNetworkUpgrade(cloudstackTestCase): cls.services["virtual_machine"]["zoneid"] = cls.zone.id cls.services["virtual_machine"]["template"] = cls.template.id + cls._cleanup = [] cls.service_offering = ServiceOffering.create( cls.api_client, cls.services["service_offering"] ) + cls._cleanup.append(cls.service_offering) cls.vpc_off = VpcOffering.create( cls.api_client, cls.services["vpc_offering"] ) cls.vpc_off.update(cls.api_client, state='Enabled') - cls._cleanup = [ - cls.service_offering, - cls.vpc_off - ] + cls._cleanup.append(cls.vpc_off) return @classmethod @@ -2135,15 +2132,18 @@ class TestVPCNetworkGc(cloudstackTestCase): ) cls.services["virtual_machine"]["zoneid"] = cls.zone.id cls.services["virtual_machine"]["template"] = cls.template.id + cls._cleanup = [] cls.service_offering = ServiceOffering.create( cls.api_client, cls.services["service_offering"] ) + cls._cleanup.append(cls.service_offering) cls.vpc_off = VpcOffering.create( cls.api_client, cls.services["vpc_offering"] ) + cls._cleanup.append(cls.vpc_off) cls.vpc_off.update(cls.api_client, state='Enabled') cls.account = Account.create( @@ -2152,6 +2152,7 @@ class TestVPCNetworkGc(cloudstackTestCase): admin=True, domainid=cls.domain.id ) + cls._cleanup.append(cls.account) cls.services["vpc"]["cidr"] = '10.1.1.1/16' cls.vpc = VPC.create( @@ -2168,6 +2169,7 @@ class TestVPCNetworkGc(cloudstackTestCase): cls.services["network_offering"], conservemode=False ) + cls._cleanup.append(cls.nw_off) # Enable Network offering cls.nw_off.update(cls.api_client, state='Enabled') @@ -2243,12 +2245,6 @@ class TestVPCNetworkGc(cloudstackTestCase): services=cls.services["icmp_rule"], traffictype='Egress' ) - cls._cleanup = [ - cls.account, - cls.service_offering, - cls.vpc_off, - cls.nw_off - ] return @classmethod