Chandan Purushothama created CLOUDSTACK-7368:
------------------------------------------------
Summary: [Automation] Fix the script "test_add_remove_network.py"
- Accounts are not cleaned up during successful test execution
Key: CLOUDSTACK-7368
URL: https://issues.apache.org/jira/browse/CLOUDSTACK-7368
Project: CloudStack
Issue Type: Bug
Security Level: Public (Anyone can view this level - this is the default.)
Components: Automation, Test
Affects Versions: 4.5.0
Reporter: Chandan Purushothama
Priority: Critical
Fix For: 4.5.0
Notice that the accounts are not cleaned up during successful test execution in
the script below.
{Code}
@attr(tags = ["advanced"])
def test_24_add_nw_different_domain(self):
"""Add network to running VM"""
# 1. Create two domains
# 2. Create network in one domain and create virtual machine in other
domain
# 3. Ad isolated/shared network belonging to one domain to the vm
belonging to other domain
# Validate the following:
# 1. Adding network should fail
network = None #The network which we are adding to the vm
try:
tempCleanupList = []
self.child_domain_1 = Domain.create(self.apiclient,
services=self.services["domain"],
parentdomainid=self.domain.id)
tempCleanupList.append(self.child_domain_1)
self.child_do_admin_1 = Account.create(
self.apiclient,
self.services["account"],
admin=True,
domainid=self.child_domain_1.id
)
tempCleanupList.append(self.child_do_admin_1)
self.child_domain_2 = Domain.create(self.apiclient,
services=self.services["domain"],
parentdomainid=self.domain.id)
tempCleanupList.append(self.child_domain_2)
self.child_do_admin_2 = Account.create(
self.apiclient,
self.services["account"],
admin=True,
domainid=self.child_domain_2.id)
tempCleanupList.append(self.child_do_admin_2)
except Exception as e:
tempCleanupList.reverse()
self.cleanup += tempCleanupList
self.fail(e)
## Notice that the Accounts are not added to cleanup list to get cleaned up
during successful test execution####
network =
Network.create(self.api_client,self.services["isolated_network"],self.child_do_admin_1.name,
self.child_do_admin_1.domainid,networkofferingid=self.isolated_network_offering.id)
virtual_machine = VirtualMachine.create(self.apiclient,
self.services["virtual_machine"],accountid=self.child_do_admin_2.name,
domainid=self.child_do_admin_2.domainid,
serviceofferingid=self.service_offering.id,
mode=self.zone.networktype)
time.sleep(self.services["sleep"])
self.debug("Trying to %s network in domain %s to a vm in domain %s,
This should fail" %
(network.type, self.child_domain_1.name,
self.child_domain_2.name))
with self.assertRaises(Exception) as e:
virtual_machine.add_nic(self.apiclient, network.id)
self.debug("Operation failed with exception %s" % e.exception)
return
{Code}
--
This message was sent by Atlassian JIRA
(v6.2#6252)