Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 20 additions & 17 deletions test/integration/component/test_acl_sharednetwork.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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"
Expand Down Expand Up @@ -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):
Expand Down Expand Up @@ -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):
"""
Expand Down
4 changes: 3 additions & 1 deletion tools/marvin/marvin/cloudstackTestCase.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down