cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tall...@apache.org
Subject [1/2] git commit: updated refs/heads/master to fe0a55f
Date Fri, 05 Dec 2014 05:48:31 GMT
Repository: cloudstack
Updated Branches:
  refs/heads/master 774394792 -> fe0a55fb5


CLOUDSTACK-8003: test_egress_fw_rules.py - Remove test case dependency on each other and improve
cleanup code

Signed-off-by: SrikanteswaraRao Talluri <talluri@apache.org>


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/fe0a55fb
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/fe0a55fb
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/fe0a55fb

Branch: refs/heads/master
Commit: fe0a55fb5747b2343e83d30990737aa48f78b57d
Parents: 6f046bd
Author: Gaurav Aradhye <gaurav.aradhye@clogeny.com>
Authored: Wed Dec 3 11:23:42 2014 +0530
Committer: SrikanteswaraRao Talluri <talluri@apache.org>
Committed: Fri Dec 5 11:18:19 2014 +0530

----------------------------------------------------------------------
 .../component/test_egress_fw_rules.py           | 65 ++++----------------
 1 file changed, 11 insertions(+), 54 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/fe0a55fb/test/integration/component/test_egress_fw_rules.py
----------------------------------------------------------------------
diff --git a/test/integration/component/test_egress_fw_rules.py b/test/integration/component/test_egress_fw_rules.py
index 4f95925..5f0ca92 100755
--- a/test/integration/component/test_egress_fw_rules.py
+++ b/test/integration/component/test_egress_fw_rules.py
@@ -18,9 +18,8 @@
 """
 """
 #Import Local Modules
-import unittest
 from nose.plugins.attrib           import attr
-from marvin.cloudstackTestCase     import cloudstackTestCase
+from marvin.cloudstackTestCase     import cloudstackTestCase, unittest
 from marvin.lib.base   import (Account,
                                            Domain,
                                            Router,
@@ -35,7 +34,6 @@ from marvin.lib.common import (get_domain,
                                            get_zone,
                                            get_template,
                                            list_routers,
-                                           wait_for_cleanup,
                                            list_virtual_machines
                                            )
 from marvin.lib.utils import cleanup_resources, validateList
@@ -146,16 +144,6 @@ class TestEgressFWRules(cloudstackTestCase):
                                     cls.services["ostype"])
         cls.services["virtual_machine"]["zoneid"] = cls.zone.id
         cls.services["virtual_machine"]["template"] = cls.template.id
-        parentDomain = None
-        cls.domain  =  Domain.create(cls.api_client,
-                                     cls.services["domain"],
-                                     parentdomainid=parentDomain.id if parentDomain else
None)
-        cls._cleanup.append(cls.domain)
-        # Create an Account associated with domain
-        cls.account = Account.create(cls.api_client,
-                                     cls.services["account"],
-                                     domainid=cls.domain.id)
-        cls._cleanup.append(cls.account)
         # Create service offerings.
         cls.service_offering = ServiceOffering.create(cls.api_client,
                                                       cls.services["service_offering"])
@@ -173,11 +161,16 @@ class TestEgressFWRules(cloudstackTestCase):
     def setUp(self):
         self.apiclient = self.api_client
         self.dbclient = self.testClient.getDbConnection()
-        self.cleanup_vms = []
-        self.cleanup_networks = []
-        self.cleanup   = []
-        self.snapshot  = None
         self.egressruleid = None
+        self.cleanup   = []
+        self.domain  =  Domain.create(self.apiclient,
+                                      self.services["domain"])
+        # Create an Account associated with domain
+        self.account = Account.create(self.apiclient,
+                                      self.services["account"],
+                                      domainid=self.domain.id)
+        self.cleanup.append(self.account)
+        self.cleanup.append(self.domain)
         return
 
     def create_network_offering(self, egress_policy=True, RR=False):
@@ -211,7 +204,6 @@ class TestEgressFWRules(cloudstackTestCase):
                                       domainid=self.account.domainid,
                                       networkofferingid=self.network_offering.id,
                                       zoneid=self.zone.id)
-        self.cleanup_networks.append(self.network)
         self.debug("Created network with ID: %s" % self.network.id)
         self.debug("Deploying instance in the account: %s" % self.account.name)
 
@@ -225,7 +217,6 @@ class TestEgressFWRules(cloudstackTestCase):
                                                          mode=self.zone.networktype if pfrule
else 'basic',
                                                          networkids=[str(self.network.id)],
                                                          projectid=project.id if project
else None)
-            self.cleanup_vms.append(self.virtual_machine)
         except Exception as e:
             self.fail("Virtual machine deployment failed with exception: %s" % e)
         self.debug("Deployed instance %s in account: %s" % (self.virtual_machine.id,self.account.name))
@@ -346,42 +337,8 @@ class TestEgressFWRules(cloudstackTestCase):
 
     def tearDown(self):
         try:
-            if self.egressruleid:
-                self.debug('remove egress rule id=%s' % self.egressruleid)
-                self.deleteEgressRule()
-
             self.debug("Cleaning up the resources")
-
-            #below components is not a part of cleanup because to mandate the order and to
cleanup network
-            try:
-                for vm in self.cleanup_vms:
-                    if str(vm.state).lower() != "error":
-                        vm.delete(self.api_client)
-            except Exception as e:
-                self.fail("Warning: Exception during virtual machines cleanup : %s" % e)
-
-            if len(self.cleanup_vms) > 0:
-                retriesCount = 10
-                while True:
-                    vms = list_virtual_machines(self.api_client, id=self.virtual_machine.id)
-                    if vms is None:
-                        break
-                    elif retriesCount == 0:
-                        self.fail("Failed to expunge vm even after 10 minutes")
-                    time.sleep(60)
-                    retriesCount -= 1
-
-            try:
-                for network in self.cleanup_networks:
-                    network.delete(self.api_client)
-            except Exception as e:
-                self.fail("Warning: Exception during networks cleanup : %s" % e)
-
-            self.debug("Sleep for Network cleanup to complete.")
-            wait_for_cleanup(self.apiclient, ["network.gc.wait", "network.gc.interval"])
-
-            cleanup_resources(self.apiclient, reversed(self.cleanup))
-            self.debug("Cleanup complete!")
+            cleanup_resources(self.apiclient, self.cleanup)
         except Exception as e:
             self.fail("Warning! Cleanup failed: %s" % e)
 


Mime
View raw message