diff --git a/test/integration/component/test_acl_sharednetwork.py b/test/integration/component/test_acl_sharednetwork.py index 42f4a899e129..d46f70c100da 100644 --- a/test/integration/component/test_acl_sharednetwork.py +++ b/test/integration/component/test_acl_sharednetwork.py @@ -67,6 +67,24 @@ def setUpClass(cls): cls.default_apikey = cls.apiclient.connection.apiKey cls.default_secretkey = cls.apiclient.connection.securityKey + cls.zone = get_zone(cls.apiclient,cls.testclient.getZoneForTests()) + + list_shared_network_offerings_response = NetworkOffering.list( + cls.apiclient, + name="DefaultSharedNetworkOffering", + displayText="Offering for Shared networks" + ) + + cls.shared_network_offering_id = list_shared_network_offerings_response[0].id + + cls.shared_network_all = Network.create( + cls.apiclient, + cls.acldata["network_all"], + networkofferingid=cls.shared_network_offering_id, + zoneid=cls.zone.id + ) + cls._cleanup.append(cls.shared_network_all) + # Create domains cls.domain_1 = Domain.create( cls.apiclient, @@ -252,21 +270,12 @@ def setUpClass(cls): cls.acldata["service_offering"]["small"] ) - cls.zone = get_zone(cls.apiclient,cls.testclient.getZoneForTests()) cls.acldata['mode'] = cls.zone.networktype cls.template = get_template(cls.apiclient, cls.zone.id, cls.acldata["ostype"]) cls.apiclient.connection.apiKey = cls.default_apikey cls.apiclient.connection.securityKey = cls.default_secretkey - list_shared_network_offerings_response = NetworkOffering.list( - cls.apiclient, - name="DefaultSharedNetworkOffering", - displayText="Offering for Shared networks" - ) - - cls.shared_network_offering_id = list_shared_network_offerings_response[0].id - #Override vlan parameter so that there is no overlap with vlans being used in other shared network impersonation test suite cls.acldata["network_all"]["vlan"]="3001" cls.acldata["network_domain_with_no_subdomain_access"]["vlan"]="3002" @@ -316,19 +325,14 @@ def setUpClass(cls): cls.service_offering, ] except Exception as e: - cls.domain_1.delete(cls.apiclient,cleanup="true") - cls.domain_2.delete(cls.apiclient,cleanup="true") - cleanup_resources(cls.apiclient, cls.cleanup) - raise Exception("Failed to create the setup required to execute the test cases: %s" % e) + raise Exception("Failed to create the setup required to execute the test cases: %s" % e) @classmethod def tearDownClass(cls): cls.apiclient = super(TestSharedNetwork, cls).getClsTestClient().getApiClient() cls.apiclient.connection.apiKey = cls.default_apikey cls.apiclient.connection.securityKey = cls.default_secretkey - cls.domain_1.delete(cls.apiclient,cleanup="true") - cls.domain_2.delete(cls.apiclient,cleanup="true") - cleanup_resources(cls.apiclient, cls.cleanup) + cls.apiclient = super(TestSharedNetwork, cls).tearDownClass() return def setUp(cls): @@ -692,7 +696,6 @@ def test_deployVM_in_sharedNetwork_scope_domain_nosubdomainaccess_ROOTuser(self) self.fail("Error message validation failed when ROOT domain's user tries to deploy VM in a shared network with scope=domain with no subdomain access") - @attr("simulator_only",tags=["advanced"],required_hardware="false") def test_deployVM_in_sharedNetwork_scope_domain_nosubdomainaccess_ROOTadmin(self): """ diff --git a/tools/marvin/marvin/cloudstackTestCase.py b/tools/marvin/marvin/cloudstackTestCase.py index d178b6ec139b..b44386a3a6a8 100644 --- a/tools/marvin/marvin/cloudstackTestCase.py +++ b/tools/marvin/marvin/cloudstackTestCase.py @@ -99,7 +99,9 @@ def cleanup_resources(cls, api_client, resources): Delete resources (created during tests) """ for obj in resources: - if isinstance(obj, VirtualMachine): + if isinstance(obj, Domain): + obj.delete(api_client, cleanup=True) + elif isinstance(obj, VirtualMachine): obj.delete(api_client, expunge=True) else: obj.delete(api_client)