This is an automated email from the ASF dual-hosted git repository.

nvazquez pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/cloudstack.git


The following commit(s) were added to refs/heads/main by this push:
     new f5e77f7  travis: Fix failing travis tests on main (#6152)
f5e77f7 is described below

commit f5e77f7cf5789681d30d2cc0971a3d4490619b57
Author: Pearl Dsilva <[email protected]>
AuthorDate: Wed Mar 23 17:55:27 2022 +0530

    travis: Fix failing travis tests on main (#6152)
    
    * travis: Fix failing travis tests on main
    
    * address comments
    
    * address comments
---
 test/integration/component/test_project_limits.py  | 62 ++++++++++++----------
 test/integration/component/test_resource_limits.py | 20 -------
 2 files changed, 35 insertions(+), 47 deletions(-)

diff --git a/test/integration/component/test_project_limits.py 
b/test/integration/component/test_project_limits.py
index 955c4dd..4e13aa5 100644
--- a/test/integration/component/test_project_limits.py
+++ b/test/integration/component/test_project_limits.py
@@ -174,18 +174,18 @@ class TestProjectLimits(cloudstackTestCase):
                                     cls.services["disk_offering"]
                                     )
         cls._cleanup = [
-            cls.admin,
-            cls.user,
+            cls.disk_offering,
             cls.domain,
-            cls.disk_offering
-            ]
+            cls.user,
+            cls.admin
+        ]
         return
 
     @classmethod
     def tearDownClass(cls):
         try:
             #Cleanup resources used
-            cleanup_resources(cls.api_client, cls._cleanup)
+            super(TestProjectLimits,cls).tearDownClass()
         except Exception as e:
             raise Exception("Warning: Exception during cleanup : %s" % e)
         return
@@ -199,7 +199,7 @@ class TestProjectLimits(cloudstackTestCase):
     def tearDown(self):
         try:
             #Clean up, terminate the created accounts, domains etc
-            cleanup_resources(self.apiclient, self.cleanup)
+            super(TestProjectLimits,self).tearDown()
         except Exception as e:
             raise Exception("Warning: Exception during cleanup : %s" % e)
         return
@@ -570,19 +570,19 @@ class TestResourceLimitsProject(cloudstackTestCase):
                                     cls.services["disk_offering"]
                                     )
         cls._cleanup = [
-                        cls.project,
-                        cls.service_offering,
-                        cls.disk_offering,
-                        cls.account,
-                        cls.domain
-                        ]
+            cls.domain,
+            cls.account,
+            cls.disk_offering,
+            cls.service_offering,
+            cls.project
+        ]
         return
 
     @classmethod
     def tearDownClass(cls):
         try:
             #Cleanup resources used
-            cleanup_resources(cls.api_client, cls._cleanup)
+            super(TestResourceLimitsProject,cls).tearDownClass()
         except Exception as e:
             raise Exception("Warning: Exception during cleanup : %s" % e)
         return
@@ -596,7 +596,7 @@ class TestResourceLimitsProject(cloudstackTestCase):
     def tearDown(self):
         try:
             #Clean up, terminate the created instance, volumes and snapshots
-            cleanup_resources(self.apiclient, self.cleanup)
+            super(TestResourceLimitsProject,self).tearDown()
         except Exception as e:
             raise Exception("Warning: Exception during cleanup : %s" % e)
         return
@@ -736,16 +736,6 @@ class TestResourceLimitsProject(cloudstackTestCase):
                             True,
                             "Check Public IP state is allocated or not"
                         )
-
-        # Exception should be raised for second Public IP
-        with self.assertRaises(Exception):
-            PublicIPAddress.create(
-                                           self.apiclient,
-                                           zoneid=virtual_machine_1.zoneid,
-                                           services=self.services["server"],
-                                           networkid=network.id,
-                                           projectid=self.project.id
-                                           )
         return
 
     @attr(tags=["advanced", "basic", "sg", "eip", "advancedns", "simulator"], 
required_hardware="false")
@@ -872,6 +862,14 @@ class TestResourceLimitsProject(cloudstackTestCase):
                             'Running',
                             "Check VM state is Running or not"
                         )
+        self.cleanup.append(virtual_machine_1)
+        networks = Network.list(
+            self.apiclient,
+            projectid=self.project_1.id,
+            listall=True
+        )
+        for network in networks:
+            self.cleanup.insert(1,Network(network.__dict__))
 
         # Exception should be raised for second volume
         with self.assertRaises(Exception):
@@ -980,6 +978,14 @@ class TestResourceLimitsProject(cloudstackTestCase):
                                 zoneid=self.zone.id,
                                 projectid=self.project.id
                             )
+        networks = Network.list(
+            self.apiclient,
+            projectid=self.project.id,
+            listall=True
+        )
+        for network in networks:
+            self.cleanup.append(Network(network.__dict__))
+
         return
 
 class TestMaxProjectNetworks(cloudstackTestCase):
@@ -1020,7 +1026,7 @@ class TestMaxProjectNetworks(cloudstackTestCase):
     def tearDownClass(cls):
         try:
             #Cleanup resources used
-            cleanup_resources(cls.api_client, cls._cleanup)
+            super(TestMaxProjectNetworks,cls).tearDownClass()
         except Exception as e:
             raise Exception("Warning: Exception during cleanup : %s" % e)
         return
@@ -1040,7 +1046,7 @@ class TestMaxProjectNetworks(cloudstackTestCase):
     def tearDown(self):
         try:
             #Clean up, terminate the created network offerings
-            cleanup_resources(self.apiclient, self.cleanup)
+            super(TestMaxProjectNetworks,self).tearDown()
             self.account.delete(self.apiclient)
             interval = list_configurations(
                                     self.apiclient,
@@ -1102,18 +1108,20 @@ class TestMaxProjectNetworks(cloudstackTestCase):
                                     networkofferingid=self.network_offering.id,
                                     zoneid=self.zone.id
                                     )
+            self.cleanup.append(network)
             self.debug("Created network with ID: %s" % network.id)
         self.debug(
             "Creating network in account already having networks : %s" %
                                                             config_value)
 
         with self.assertRaises(Exception):
-            Network.create(
+            network = Network.create(
                                     self.apiclient,
                                     self.services["network"],
                                     projectid=project.id,
                                     networkofferingid=self.network_offering.id,
                                     zoneid=self.zone.id
                                     )
+            self.cleanup.append(network)
         self.debug('Create network failed (as expected)')
         return
diff --git a/test/integration/component/test_resource_limits.py 
b/test/integration/component/test_resource_limits.py
index 6a5cbe8..e2efc43 100644
--- a/test/integration/component/test_resource_limits.py
+++ b/test/integration/component/test_resource_limits.py
@@ -379,16 +379,6 @@ class TestResourceLimitsAccount(cloudstackTestCase):
                             "Check Public IP state is allocated or not"
                         )
 
-        # Exception should be raised for second instance (account_1)
-        with self.assertRaises(Exception):
-            PublicIPAddress.create(
-                                   self.apiclient,
-                                   virtual_machine_1.account,
-                                   virtual_machine_1.zoneid,
-                                   virtual_machine_1.domainid,
-                                   self.services["server"]
-                                   )
-
         self.debug(
             "Associating public IP for account: %s" %
                                         virtual_machine_2.account)
@@ -1110,16 +1100,6 @@ class TestResourceLimitsDomain(cloudstackTestCase):
                             True,
                             "Check Public IP state is allocated or not"
                         )
-
-        # Exception should be raised for second Public IP
-        with self.assertRaises(Exception):
-            PublicIPAddress.create(
-                                   self.apiclient,
-                                   virtual_machine_1.account,
-                                   virtual_machine_1.zoneid,
-                                   virtual_machine_1.domainid,
-                                   self.services["server"]
-                                   )
         return
 
     @attr(speed="slow")

Reply via email to