Return-Path: X-Original-To: apmail-cloudstack-commits-archive@www.apache.org Delivered-To: apmail-cloudstack-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 577D911D05 for ; Mon, 28 Jul 2014 21:13:41 +0000 (UTC) Received: (qmail 80863 invoked by uid 500); 28 Jul 2014 21:13:30 -0000 Delivered-To: apmail-cloudstack-commits-archive@cloudstack.apache.org Received: (qmail 80825 invoked by uid 500); 28 Jul 2014 21:13:30 -0000 Mailing-List: contact commits-help@cloudstack.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cloudstack.apache.org Delivered-To: mailing list commits@cloudstack.apache.org Received: (qmail 79918 invoked by uid 99); 28 Jul 2014 21:13:30 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 28 Jul 2014 21:13:30 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id DA2A29B8A54; Mon, 28 Jul 2014 21:13:29 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: dahn@apache.org To: commits@cloudstack.apache.org Date: Mon, 28 Jul 2014 21:13:56 -0000 Message-Id: In-Reply-To: <294c500168744efe89e6fc45a6409bfa@git.apache.org> References: <294c500168744efe89e6fc45a6409bfa@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [28/50] [abbrv] git commit: updated refs/heads/4.4 to 2025f35 CLOUDSTACK-6887: Code enhancement to ensure better cleanup (cherry picked from commit 588e3e37afdd5740816d1225d449164ed2024c03) Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/b44f66e1 Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/b44f66e1 Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/b44f66e1 Branch: refs/heads/4.4 Commit: b44f66e12fe6e43888c93548158e7caa99101c9a Parents: 12b6cf1 Author: Gaurav Aradhye Authored: Wed Jun 18 13:06:55 2014 +0530 Committer: Daan Hoogland Committed: Mon Jul 28 23:12:49 2014 +0200 ---------------------------------------------------------------------- test/integration/component/test_accounts.py | 83 +++++++++++--------- .../component/test_add_remove_network.py | 68 +++++++++------- .../component/test_affinity_groups.py | 64 ++++++--------- test/integration/component/test_portable_ip.py | 22 +++--- test/integration/component/test_vpc_network.py | 10 +-- 5 files changed, 125 insertions(+), 122 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/b44f66e1/test/integration/component/test_accounts.py ---------------------------------------------------------------------- diff --git a/test/integration/component/test_accounts.py b/test/integration/component/test_accounts.py index cf5f2b6..a39880c 100644 --- a/test/integration/component/test_accounts.py +++ b/test/integration/component/test_accounts.py @@ -272,8 +272,8 @@ class TestRemoveUserFromAccount(cloudstackTestCase): cls.services["account"] ) - cls._cleanup = [ - cls.service_offering, + cls._cleanup = [cls.account, + cls.service_offering, ] return @@ -773,6 +773,13 @@ class TestTemplateHierarchy(cloudstackTestCase): domainid=cls.domain_2.id ) + cls._cleanup = [ + cls.account_2, + cls.domain_2, + cls.account_1, + cls.domain_1, + ] + builtin_info = get_builtin_template_info(cls.api_client, cls.zone.id) cls.services["template"]["url"] = builtin_info[0] cls.services["template"]["hypervisor"] = builtin_info[1] @@ -793,14 +800,6 @@ class TestTemplateHierarchy(cloudstackTestCase): # Wait for template status to be changed across time.sleep(60) - - cls._cleanup = [ - cls.account_2, - cls.domain_2, - cls.template, - cls.account_1, - cls.domain_1, - ] return @classmethod @@ -926,6 +925,13 @@ class TestAddVmToSubDomain(cloudstackTestCase): cls.services["service_offering"], domainid=cls.domain.id ) + + cls._cleanup = [ + cls.account_2, + cls.account_1, + cls.sub_domain, + cls.service_offering + ] cls.template = get_template( cls.api_client, cls.zone.id, @@ -949,12 +955,6 @@ class TestAddVmToSubDomain(cloudstackTestCase): domainid=cls.account_2.domainid, serviceofferingid=cls.service_offering.id ) - cls._cleanup = [ - cls.account_2, - cls.account_1, - cls.sub_domain, - cls.service_offering - ] return @classmethod @@ -1573,16 +1573,17 @@ class TestDomainForceRemove(cloudstackTestCase): domainid=domain.id ) - self.debug("Creating a tiny service offering for VM deployment") - self.service_offering = ServiceOffering.create( + try: + self.debug("Creating a tiny service offering for VM deployment") + self.service_offering = ServiceOffering.create( self.apiclient, self.services["service_offering"], domainid=self.domain.id ) - self.debug("Deploying virtual machine in account 1: %s" % + self.debug("Deploying virtual machine in account 1: %s" % self.account_1.name) - vm_1 = VirtualMachine.create( + vm_1 = VirtualMachine.create( self.apiclient, self.services["virtual_machine"], templateid=self.template.id, @@ -1591,9 +1592,9 @@ class TestDomainForceRemove(cloudstackTestCase): serviceofferingid=self.service_offering.id ) - self.debug("Deploying virtual machine in account 2: %s" % + self.debug("Deploying virtual machine in account 2: %s" % self.account_2.name) - vm_2 = VirtualMachine.create( + VirtualMachine.create( self.apiclient, self.services["virtual_machine"], templateid=self.template.id, @@ -1602,22 +1603,22 @@ class TestDomainForceRemove(cloudstackTestCase): serviceofferingid=self.service_offering.id ) - networks = Network.list( + networks = Network.list( self.apiclient, account=self.account_1.name, domainid=self.account_1.domainid, listall=True ) - self.assertEqual( + self.assertEqual( isinstance(networks, list), True, "List networks should return a valid response" ) - network_1 = networks[0] - self.debug("Default network in account 1: %s is %s" % ( + network_1 = networks[0] + self.debug("Default network in account 1: %s is %s" % ( self.account_1.name, network_1.name)) - src_nat_list = PublicIPAddress.list( + src_nat_list = PublicIPAddress.list( self.apiclient, associatednetworkid=network_1.id, account=self.account_1.name, @@ -1625,44 +1626,48 @@ class TestDomainForceRemove(cloudstackTestCase): listall=True, issourcenat=True, ) - self.assertEqual( + self.assertEqual( isinstance(src_nat_list, list), True, "List Public IP should return a valid source NAT" ) - self.assertNotEqual( + self.assertNotEqual( len(src_nat_list), 0, "Length of response from listPublicIp should not be 0" ) - src_nat = src_nat_list[0] + src_nat = src_nat_list[0] - self.debug( - "Trying to create a port forwarding rule in source NAT: %s" % + self.debug( + "Trying to create a port forwarding rule in source NAT: %s" % src_nat.ipaddress) - #Create NAT rule - nat_rule = NATRule.create( + #Create NAT rule + nat_rule = NATRule.create( self.apiclient, vm_1, self.services["natrule"], ipaddressid=src_nat.id ) - self.debug("Created PF rule on source NAT: %s" % src_nat.ipaddress) + self.debug("Created PF rule on source NAT: %s" % src_nat.ipaddress) - nat_rules = NATRule.list(self.apiclient, id=nat_rule.id) + nat_rules = NATRule.list(self.apiclient, id=nat_rule.id) - self.assertEqual( + self.assertEqual( isinstance(nat_rules, list), True, "List NAT should return a valid port forwarding rules" ) - self.assertNotEqual( + self.assertNotEqual( len(nat_rules), 0, "Length of response from listLbRules should not be 0" ) + except Exception as e: + self.clenaup.append(self.account_1) + self.cleanup.append(self.account_2) + self.fail(e) self.debug("Deleting domain with force option") try: @@ -1759,7 +1764,7 @@ class TestDomainForceRemove(cloudstackTestCase): self.debug("Deploying virtual machine in account 2: %s" % self.account_2.name) - vm_2 = VirtualMachine.create( + VirtualMachine.create( self.apiclient, self.services["virtual_machine"], templateid=self.template.id, http://git-wip-us.apache.org/repos/asf/cloudstack/blob/b44f66e1/test/integration/component/test_add_remove_network.py ---------------------------------------------------------------------- diff --git a/test/integration/component/test_add_remove_network.py b/test/integration/component/test_add_remove_network.py index 609a67e..dbba59b 100644 --- a/test/integration/component/test_add_remove_network.py +++ b/test/integration/component/test_add_remove_network.py @@ -196,10 +196,13 @@ class TestAddNetworkToVirtualMachine(cloudstackTestCase): # Create Accounts & networks cls.services["isolated_network"]["zoneid"] = cls.zone.id cls.services["shared_network"]["zoneid"] = cls.zone.id + cls._cleanup = [] cls.account = Account.create(cls.api_client, cls.services["account"], domainid = cls.domain.id) + cls._cleanup.append(cls.account) cls.service_offering = ServiceOffering.create(cls.api_client,cls.services["service_offering"]) + cls._cleanup.append(cls.service_offering) cls.virtual_machine = VirtualMachine.create(cls.api_client, cls.services["virtual_machine"],accountid=cls.account.name, domainid=cls.account.domainid, serviceofferingid=cls.service_offering.id, @@ -209,6 +212,7 @@ class TestAddNetworkToVirtualMachine(cloudstackTestCase): # Create Shared Network Offering cls.isolated_network_offering = NetworkOffering.create(cls.api_client, cls.services["isolated_network_offering"]) + cls._cleanup.append(cls.isolated_network_offering) # Enable Isolated Network offering cls.isolated_network_offering.update(cls.api_client, state='Enabled') @@ -232,9 +236,8 @@ class TestAddNetworkToVirtualMachine(cloudstackTestCase): cls.shared_network = Network.create(cls.api_client,cls.services["shared_network"],cls.account.name, cls.account.domainid,networkofferingid=cls.shared_network_offering.id) - - cls._cleanup = [cls.account,cls.service_offering,cls.shared_network,cls.isolated_network_offering, - cls.shared_network_offering] + cls._cleanup.append(cls.shared_network) + cls._cleanup.append(cls.shared_network_offering) return def setUp(self): @@ -602,37 +605,40 @@ class TestAddNetworkToVirtualMachine(cloudstackTestCase): network = None #The network which we are adding to the vm - self.child_domain_1 = Domain.create(self.apiclient, + try: + tempCleanupList = [] + self.child_domain_1 = Domain.create(self.apiclient, services=self.services["domain"], parentdomainid=self.domain.id) + tempCleanupList.append(self.child_domain_1) - self.child_do_admin_1 = Account.create( + self.child_do_admin_1 = Account.create( self.apiclient, self.services["account"], admin=True, domainid=self.child_domain_1.id ) + tempCleanupList.append(self.child_do_admin_1) - self.debug("Creating a domain under: %s" % self.domain.name) - - self.child_domain_2 = Domain.create(self.apiclient, + self.child_domain_2 = Domain.create(self.apiclient, services=self.services["domain"], parentdomainid=self.domain.id) + tempCleanupList.append(self.child_domain_2) - self.child_do_admin_2 = Account.create( + self.child_do_admin_2 = Account.create( self.apiclient, self.services["account"], admin=True, domainid=self.child_domain_2.id) + tempCleanupList.append(self.child_do_admin_2) + except Exception as e: + tempCleanupList.reverse() + self.cleanup += tempCleanupList + self.fail(e) network = Network.create(self.api_client,self.services["isolated_network"],self.child_do_admin_1.name, self.child_do_admin_1.domainid,networkofferingid=self.isolated_network_offering.id) - self.cleanup.append(self.child_do_admin_1) - self.cleanup.append(self.child_domain_1) - self.cleanup.append(self.child_do_admin_2) - self.cleanup.append(self.child_domain_2) - virtual_machine = VirtualMachine.create(self.apiclient, self.services["virtual_machine"],accountid=self.child_do_admin_2.name, domainid=self.child_do_admin_2.domainid, serviceofferingid=self.service_offering.id, mode=self.zone.networktype) @@ -663,12 +669,9 @@ class TestAddNetworkToVirtualMachine(cloudstackTestCase): self.services["account"], domainid=self.domain.id ) - self.debug("create account %s" % account_1.name) - self.cleanup.append(account_1) self.debug("setting network limit of account: %s as 1" % account_1.name) - update_resource_limit( self.apiclient, 6, # Network @@ -744,22 +747,25 @@ class TestRemoveNetworkFromVirtualMachine(cloudstackTestCase): # Create Accounts & networks cls.services["isolated_network"]["zoneid"] = cls.zone.id cls.services["shared_network"]["zoneid"] = cls.zone.id + cls._cleanup = [] cls.account = Account.create(cls.api_client,cls.services["account"],domainid = cls.domain.id) + cls._cleanup.append(cls.account) cls.service_offering = ServiceOffering.create(cls.api_client,cls.services["service_offering"]) + cls._cleanup.append(cls.service_offering) cls.virtual_machine = VirtualMachine.create(cls.api_client,cls.services["virtual_machine"],accountid=cls.account.name, domainid=cls.account.domainid,serviceofferingid=cls.service_offering.id, mode=cls.zone.networktype) # Create Shared Network Offering cls.isolated_network_offering = NetworkOffering.create(cls.api_client,cls.services["isolated_network_offering"]) + cls._cleanup.append(cls.isolated_network_offering) + # Enable Isolated Network offering cls.isolated_network_offering.update(cls.api_client, state='Enabled') cls.isolated_network = Network.create(cls.api_client,cls.services["isolated_network"],cls.account.name, cls.account.domainid,networkofferingid=cls.isolated_network_offering.id) - - cls._cleanup = [cls.account,cls.service_offering,cls.isolated_network_offering,] return def setUp(self): @@ -1141,21 +1147,25 @@ class TestFailureScenariosAddNetworkToVM(cloudstackTestCase): cls.services["virtual_machine"]["template"] = template.id # Create Accounts & networks cls.services["isolated_network"]["zoneid"] = cls.zone.id + cls._cleanup = [] cls.account = Account.create(cls.api_client,cls.services["account"],domainid = cls.domain.id) + cls._cleanup.append(cls.account) + cls.service_offering = ServiceOffering.create(cls.api_client,cls.services["service_offering"]) + cls._cleanup.append(cls.service_offering) cls.virtual_machine = VirtualMachine.create(cls.api_client,cls.services["virtual_machine"], accountid=cls.account.name,domainid=cls.account.domainid, serviceofferingid=cls.service_offering.id,mode=cls.zone.networktype) # Create Shared Network Offering cls.isolated_network_offering = NetworkOffering.create(cls.api_client,cls.services["isolated_network_offering"],) + cls._cleanup.append(cls.isolated_network_offering) + # Enable Isolated Network offering cls.isolated_network_offering.update(cls.api_client, state='Enabled') cls.isolated_network = Network.create(cls.api_client,cls.services["isolated_network"],cls.account.name, cls.account.domainid,networkofferingid=cls.isolated_network_offering.id) - - cls._cleanup = [cls.account,cls.service_offering,cls.isolated_network_offering,] return def setUp(self): @@ -1378,9 +1388,14 @@ class TestFailureScenariosRemoveNicFromVM(cloudstackTestCase): # Create Accounts & networks cls.services["isolated_network"]["zoneid"] = cls.zone.id cls.services["shared_network"]["zoneid"] = cls.zone.id + cls._cleanup = [] cls.account = Account.create(cls.api_client,cls.services["account"],domainid = cls.domain.id) + cls.append(cls.account) + cls.service_offering = ServiceOffering.create(cls.api_client,cls.services["service_offering"]) + cls._cleanup.append(cls.service_offering) + cls.virtual_machine = VirtualMachine.create(cls.api_client,cls.services["virtual_machine"], accountid=cls.account.name,domainid=cls.account.domainid, serviceofferingid=cls.service_offering.id, @@ -1388,6 +1403,7 @@ class TestFailureScenariosRemoveNicFromVM(cloudstackTestCase): # Create Shared Network Offering cls.isolated_network_offering = NetworkOffering.create(cls.api_client, cls.services["isolated_network_offering"],) + cls._cleanup.append(cls.isolated_network_offering) # Enable Isolated Network offering cls.isolated_network_offering.update(cls.api_client, state='Enabled') cls.isolated_network = Network.create(cls.api_client,cls.services["isolated_network"],cls.account.name, @@ -1395,8 +1411,6 @@ class TestFailureScenariosRemoveNicFromVM(cloudstackTestCase): # Add network to VM cls.virtual_machine.add_nic(cls.api_client, cls.isolated_network.id) - - cls._cleanup = [cls.account,cls.service_offering,cls.isolated_network_offering,] return def setUp(self): @@ -1558,10 +1572,13 @@ class TestFailureScenariosUpdateVirtualMachineNIC(cloudstackTestCase): # Create Accounts & networks cls.services["isolated_network"]["zoneid"] = cls.zone.id cls.services["shared_network"]["zoneid"] = cls.zone.id + cls._cleanup = [] cls.account = Account.create(cls.api_client, cls.services["account"], domainid = cls.domain.id) + cls._cleanup.append(cls.account) cls.service_offering = ServiceOffering.create(cls.api_client, cls.services["service_offering"]) + cls._cleanup.append(cls.service_offering) cls.virtual_machine = VirtualMachine.create(cls.api_client,cls.services["virtual_machine"], accountid=cls.account.name,domainid=cls.account.domainid, @@ -1571,6 +1588,7 @@ class TestFailureScenariosUpdateVirtualMachineNIC(cloudstackTestCase): # Create Shared Network Offering cls.isolated_network_offering = NetworkOffering.create(cls.api_client, cls.services["isolated_network_offering"],) + cls._cleanup.append(cls.isolated_network_offering) # Enable Isolated Network offering cls.isolated_network_offering.update(cls.api_client, state='Enabled') @@ -1578,8 +1596,6 @@ class TestFailureScenariosUpdateVirtualMachineNIC(cloudstackTestCase): cls.account.name,cls.account.domainid, networkofferingid=cls.isolated_network_offering.id) cls.virtual_machine.add_nic(cls.api_client, cls.isolated_network.id) - cls._cleanup = [cls.account,cls.service_offering, - cls.isolated_network_offering,] return def setUp(self): @@ -1713,8 +1729,6 @@ class TestFailureScenariosUpdateVirtualMachineNIC(cloudstackTestCase): self.debug("Creating new account") account = Account.create(self.apiclient,self.services["account"],domainid = self.domain.id) - self.debug("Created account %s" % account.name) - self.cleanup.append(account) self.debug("Creating virtual machine in the account %s" % account.name) http://git-wip-us.apache.org/repos/asf/cloudstack/blob/b44f66e1/test/integration/component/test_affinity_groups.py ---------------------------------------------------------------------- diff --git a/test/integration/component/test_affinity_groups.py b/test/integration/component/test_affinity_groups.py index eb58777..9a53c4c 100644 --- a/test/integration/component/test_affinity_groups.py +++ b/test/integration/component/test_affinity_groups.py @@ -113,11 +113,14 @@ class TestCreateAffinityGroup(cloudstackTestCase): cls.services["template"] = cls.template.id cls.services["zoneid"] = cls.zone.id + cls._cleanup = [] + cls.account = Account.create( cls.api_client, cls.services["account"], domainid=cls.domain.id ) + cls._cleanup.append(cls.account) cls.services["account"] = cls.account.name cls.services["domainid"] = cls.domain.id @@ -126,11 +129,7 @@ class TestCreateAffinityGroup(cloudstackTestCase): cls.api_client, cls.services["service_offering"] ) - - cls._cleanup = [ - cls.service_offering, - cls.account, - ] + cls._cleanup.append(cls.service_offering) return def setUp(self): @@ -221,10 +220,9 @@ class TestCreateAffinityGroup(cloudstackTestCase): self.user = Account.create(self.api_client, self.services["new_account"], domainid=self.domain.id) + self.cleanup.append(self.user) userapiclient = self.testClient.getUserApiClient(self.user.name, self.domain.name) - - self.cleanup.append(self.user) aff_grp = self.create_aff_grp(api_client=userapiclient, aff_grp=self.services["host_anti_affinity"], acc=self.user.name, domainid=self.domain.id) aff_grp.delete(userapiclient) @@ -309,11 +307,14 @@ class TestListAffinityGroups(cloudstackTestCase): cls.services["template"] = cls.template.id cls.services["zoneid"] = cls.zone.id + cls._cleanup = [] + cls.account = Account.create( cls.api_client, cls.services["account"], domainid=cls.domain.id ) + cls._cleanup.append(cls.account) cls.services["account"] = cls.account.name cls.services["domainid"] = cls.domain.id @@ -322,12 +323,7 @@ class TestListAffinityGroups(cloudstackTestCase): cls.api_client, cls.services["service_offering"] ) - - cls.__cleanup = [ - cls.service_offering, - cls.account, - ] - + cls._cleanup.append(cls.service_offering) # Create multiple Affinity Groups return @@ -558,11 +554,14 @@ class TestDeleteAffinityGroups(cloudstackTestCase): cls.services["template"] = cls.template.id cls.services["zoneid"] = cls.zone.id + cls._cleanup = [] + cls.account = Account.create( cls.api_client, cls.services["account"], domainid=cls.domain.id ) + cls._cleanup.append(cls.account) cls.services["account"] = cls.account.name cls.services["domainid"] = cls.domain.id @@ -571,12 +570,7 @@ class TestDeleteAffinityGroups(cloudstackTestCase): cls.api_client, cls.services["service_offering"] ) - - cls.__cleanup = [ - cls.service_offering, - cls.account, - ] - + cls._cleanup.append(cls.service_offering) # Create multiple Affinity Groups return @@ -831,11 +825,14 @@ class TestUpdateVMAffinityGroups(cloudstackTestCase): cls.services["template"] = cls.template.id cls.services["zoneid"] = cls.zone.id + cls._cleanup = [] + cls.account = Account.create( cls.api_client, cls.services["account"], domainid=cls.domain.id ) + cls._cleanup.append(cls.account) cls.services["account"] = cls.account.name cls.services["domainid"] = cls.domain.id @@ -844,12 +841,7 @@ class TestUpdateVMAffinityGroups(cloudstackTestCase): cls.api_client, cls.services["service_offering"] ) - - cls.__cleanup = [ - cls.service_offering, - cls.account, - ] - + cls._cleanup.append(cls.service_offering) # Create multiple Affinity Groups return @@ -1118,11 +1110,14 @@ class TestDeployVMAffinityGroups(cloudstackTestCase): cls.services["template"] = cls.template.id cls.services["zoneid"] = cls.zone.id + cls._cleanup = [] + cls.account = Account.create( cls.api_client, cls.services["account"], domainid=cls.domain.id ) + cls._cleanup.append(cls.account) cls.services["account"] = cls.account.name cls.services["domainid"] = cls.domain.id @@ -1131,13 +1126,7 @@ class TestDeployVMAffinityGroups(cloudstackTestCase): cls.api_client, cls.services["service_offering"] ) - - cls.__cleanup = [ - cls.service_offering, - cls.account, - ] - - # Create multiple Affinity Groups + cls._cleanup.append(cls.service_offering) return def setUp(self): @@ -1468,11 +1457,14 @@ class TestAffinityGroupsAdminUser(cloudstackTestCase): cls.services["template"] = cls.template.id cls.services["zoneid"] = cls.zone.id + cls._cleanup = [] + cls.account = Account.create( cls.api_client, cls.services["account"], domainid=cls.domain.id ) + cls._cleanup.append(cls.account) cls.services["account"] = cls.account.name cls.services["domainid"] = cls.domain.id @@ -1481,13 +1473,7 @@ class TestAffinityGroupsAdminUser(cloudstackTestCase): cls.api_client, cls.services["service_offering"] ) - - cls.__cleanup = [ - cls.service_offering, - cls.account, - ] - - # Create multiple Affinity Groups + cls._cleanup.append(cls.service_offering) return def setUp(self): http://git-wip-us.apache.org/repos/asf/cloudstack/blob/b44f66e1/test/integration/component/test_portable_ip.py ---------------------------------------------------------------------- diff --git a/test/integration/component/test_portable_ip.py b/test/integration/component/test_portable_ip.py index 538318d..b9c9059 100644 --- a/test/integration/component/test_portable_ip.py +++ b/test/integration/component/test_portable_ip.py @@ -235,6 +235,7 @@ class TestCreatePortablePublicIpRanges(cloudstackTestCase): self.services["account"], domainid=self.domain.id ) + self.cleanup.append(self.account) self.api_client_user = self.testClient.getUserApiClient( UserName=self.account.name, @@ -597,6 +598,7 @@ class TestAssociatePublicIp(cloudstackTestCase): domainid=cls.domain.id, admin=True ) + cls._cleanup = [cls.account, ] cls.network_offering = NetworkOffering.create( cls.api_client, @@ -615,8 +617,6 @@ class TestAssociatePublicIp(cloudstackTestCase): networkofferingid=cls.network_offering.id, zoneid=cls.zone.id ) - - cls._cleanup = [cls.account] return @classmethod @@ -907,6 +907,7 @@ class TestDisassociatePublicIp(cloudstackTestCase): # Set Zones and disk offerings cls.services["small"]["zoneid"] = cls.zone.id cls.services["small"]["template"] = template.id + cls._cleanup = [] cls.account = Account.create( cls.api_client, @@ -914,11 +915,13 @@ class TestDisassociatePublicIp(cloudstackTestCase): domainid=cls.domain.id, admin=True ) + cls._cleanup.append(cls.account) 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, @@ -928,6 +931,7 @@ class TestDisassociatePublicIp(cloudstackTestCase): # Enable Network offering cls.network_offering.update(cls.api_client, state='Enabled') + cls._cleanup.append(cls.network_offering) cls.network = Network.create( cls.api_client, @@ -947,12 +951,6 @@ class TestDisassociatePublicIp(cloudstackTestCase): networkids = [cls.network.id], mode=cls.services['mode'] ) - - cls._cleanup = [ - cls.account, - cls.service_offering, - cls.network_offering - ] return @classmethod @@ -1177,6 +1175,7 @@ class TestDeleteAccount(cloudstackTestCase): domainid=self.domain.id, admin=True ) + self.cleanup.append(self.account) portable_ip_range_services["regionid"] = self.region.id #create new portable ip range new_portable_ip_range = PortablePublicIpRange.create(self.apiclient, @@ -1200,7 +1199,6 @@ class TestDeleteAccount(cloudstackTestCase): ) self.cleanup.append(self.network_offering) except Exception as e: - self.cleanup.append(self.account) self.fail("Exception in setupClass: %s" % e) return @@ -1353,6 +1351,8 @@ class TestPortableIpTransferAcrossNetworks(cloudstackTestCase): cls.services["vm2"]["zoneid"] = cls.zone.id cls.services["vm2"]["template"] = template.id + cls._cleanup = [] + # Set Zones and Network offerings cls.account = Account.create( cls.api_client, @@ -1360,12 +1360,14 @@ class TestPortableIpTransferAcrossNetworks(cloudstackTestCase): domainid=cls.domain.id, admin=True ) + cls._cleanup.append(cls.account) cls.network_offering = NetworkOffering.create( cls.api_client, cls.services["network_offering"], conservemode=False ) + cls._cleanup.append(cls.network_offering) # Enable Network offering cls.network_offering.update(cls.api_client, state='Enabled') @@ -1407,8 +1409,6 @@ class TestPortableIpTransferAcrossNetworks(cloudstackTestCase): serviceofferingid=cls.service_offering.id, networkids = [cls.network2.id], ) - cls._cleanup = [cls.account, cls.network_offering] - return @classmethod http://git-wip-us.apache.org/repos/asf/cloudstack/blob/b44f66e1/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 a449948..c5d9da6 100644 --- a/test/integration/component/test_vpc_network.py +++ b/test/integration/component/test_vpc_network.py @@ -294,8 +294,7 @@ class TestVPCNetwork(cloudstackTestCase): admin=True, domainid=self.domain.id ) - self.cleanup = [] - self.cleanup.insert(0, self.account) + self.cleanup = [self.account, ] return def tearDown(self): @@ -1056,8 +1055,7 @@ class TestVPCNetworkRanges(cloudstackTestCase): admin=True, domainid=self.domain.id ) - self.cleanup = [] - self.cleanup.insert(0, self.account) + self.cleanup = [self.account, ] return def tearDown(self): @@ -1516,6 +1514,7 @@ class TestVPCNetworkRanges(cloudstackTestCase): admin=True, domainid=self.domain.id ) + self.cleanup.append(account) # Creating network using the network offering created self.debug("Creating network from diff account than VPC") @@ -1584,8 +1583,7 @@ class TestVPCNetworkUpgrade(cloudstackTestCase): admin=True, domainid=self.domain.id ) - self.cleanup = [] - self.cleanup.insert(0, self.account) + self.cleanup = [self.account, ] return def tearDown(self):