cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From wid...@apache.org
Subject [44/50] [abbrv] git commit: updated refs/heads/disk-cache to 6f3e4d3
Date Wed, 20 Nov 2013 14:51:14 GMT
CLOUDSTACK-5194: portable ip - Improving cleanup code to
 avoid cascading failures


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

Branch: refs/heads/disk-cache
Commit: 67b071beaac34eb5c4427f120ed3f0d5baabb75b
Parents: 2587e42
Author: Gaurav Aradhye <gaurav.aradhye@clogeny.com>
Authored: Tue Nov 19 11:18:33 2013 +0530
Committer: Girish Shilamkar <girish@clogeny.com>
Committed: Tue Nov 19 11:21:33 2013 +0530

----------------------------------------------------------------------
 test/integration/component/test_portable_ip.py | 40 ++++++++++-----------
 1 file changed, 18 insertions(+), 22 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/67b071be/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 14b6dac..d397ec4 100644
--- a/test/integration/component/test_portable_ip.py
+++ b/test/integration/component/test_portable_ip.py
@@ -235,8 +235,9 @@ class TestCreatePortablePublicIpRanges(cloudstackTestCase):
 
         self.debug("Trying to create portable ip range with non root-admin api client, should
raise exception")
         with self.assertRaises(Exception):
-            PortablePublicIpRange.create(self.api_client_user,
+            portable_ip_range = PortablePublicIpRange.create(self.api_client_user,
                                          portable_ip_range_services)
+            self.cleanup.append(portable_ip_range)
 
         return
 
@@ -258,8 +259,9 @@ class TestCreatePortablePublicIpRanges(cloudstackTestCase):
         self.debug("Trying to create portable ip range with wrong region id")
 
         with self.assertRaises(Exception):
-            PortablePublicIpRange.create(self.apiclient,
+            portable_ip_range = PortablePublicIpRange.create(self.apiclient,
                                          portable_ip_range_services)
+            self.cleanup.append(portable_ip_range)
 
         return
 
@@ -687,8 +689,6 @@ class TestAssociatePublicIp(cloudstackTestCase):
 
         self.debug("Associated default public ip address: %s" % publicipaddress.ipaddress.ipaddress)
 
-
-
         self.debug("Associating public ip address with network: %s with isportable=False"
% self.network.id)
         publicipaddressnotportable = PublicIPAddress.create(
                                     self.apiclient,
@@ -727,7 +727,7 @@ class TestAssociatePublicIp(cloudstackTestCase):
         self.debug("Trying to associate portable public ip with invalid zone id, this should
fail")
 
         with self.assertRaises(Exception):
-            PublicIPAddress.create(
+            publicipaddress = PublicIPAddress.create(
                                    self.apiclient,
                                    accountid=self.account.name,
                                    zoneid = -1,
@@ -735,6 +735,7 @@ class TestAssociatePublicIp(cloudstackTestCase):
                                    regionid = self.region.id,
                                    isportable=True
                                     )
+            publicipaddress.delete(self.apiclient)
         self.debug("Associating ip address failed")
         return
 
@@ -815,14 +816,15 @@ class TestAssociatePublicIp(cloudstackTestCase):
         except Exception as e:
             self.fail("Exception while SSHing : %s" % e)
 
-        self.debug("Deleting firewall rule")
-        fw_rule.delete(self.apiclient)
+        finally:
+            self.debug("Deleting firewall rule")
+            fw_rule.delete(self.apiclient)
 
-        self.debug("Deleting NAT rule")
-        nat_rule.delete(self.apiclient)
+            self.debug("Deleting NAT rule")
+            nat_rule.delete(self.apiclient)
 
-        self.debug("disassocoating portable ip: %s" % portableip.ipaddress.ipaddress)
-        portableip.delete(self.apiclient)
+            self.debug("disassocoating portable ip: %s" % portableip.ipaddress.ipaddress)
+            portableip.delete(self.apiclient)
         return
 
     @attr(tags=["advanced"])
@@ -858,7 +860,7 @@ class TestAssociatePublicIp(cloudstackTestCase):
 
         self.debug("Trying to associate portable public ip when no free ips available, this
should fail")
         with self.assertRaises(Exception):
-            PublicIPAddress.create(
+            portableipaddress = PublicIPAddress.create(
                                     self.apiclient,
                                     accountid=self.account.name,
                                     zoneid=self.zone.id,
@@ -866,6 +868,7 @@ class TestAssociatePublicIp(cloudstackTestCase):
                                     networkid=self.network.id,
                                     isportable=True
                                    )
+            portableipaddress.delete(self.apiclient)
 
         self.debug("Associating portable ip address failed")
 
@@ -1338,7 +1341,6 @@ class TestDeleteAccount(cloudstackTestCase):
 
         return
 
-
 class TestPortableIpTransferAcrossNetworks(cloudstackTestCase):
     """Test Transfer Portable IP Across Networks
     """
@@ -1390,7 +1392,6 @@ class TestPortableIpTransferAcrossNetworks(cloudstackTestCase):
             cls.services["service_offering"]
         )
 
-        cls.debug("creating networks and virtual machines in each network for portable ip
transfer tests: ")
         cls.network1 = Network.create(
                                     cls.api_client,
                                     cls.services["network1"],
@@ -1538,11 +1539,6 @@ class TestPortableIpTransferAcrossNetworks(cloudstackTestCase):
         except Exception as e:
             self.fail("Exception while SSHing : %s" % e)
 
-        self.debug("disassociating portable ip: %s" % portableip.ipaddress.ipaddress)
-        portableip.delete(self.apiclient)
-
-
-
-
-
-
+        finally:
+            self.debug("disassociating portable ip: %s" % portableip.ipaddress.ipaddress)
+            portableip.delete(self.apiclient)


Mime
View raw message