[ https://issues.apache.org/jira/browse/CLOUDSTACK-7368?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14103531#comment-14103531 ]
Gaurav Aradhye commented on CLOUDSTACK-7368: -------------------------------------------- Added patch: https://reviews.apache.org/r/24884/ > [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: Test > Security Level: Public(Anyone can view this level - this is the > default.) > Components: Automation, Test > Affects Versions: 4.5.0 > Reporter: Chandan Purushothama > Assignee: Gaurav Aradhye > 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} > Due to the above mentioned bug, the follow error is seen: > {Code} > test_25_add_nw_above_account_limit > (test_add_remove_network.TestAddNetworkToVirtualMachine): DEBUG: > ========Sending GET Cmd : deleteServiceOffering======= > requests.packages.urllib3.connectionpool: INFO: Starting new HTTP connection > (1): 10.223.130.79 > requests.packages.urllib3.connectionpool: DEBUG: "GET > /client/api?response=json&apiKey=ZI83p8k86jxdFO75d5mjeU5qvLiMvSK2tUnhcSfQc2TDbIJWI4MuvF1w0SkSZ3RB-pykb4VhQaLUVhq6apOqog&command=deleteServiceOffering&id=d6397b91-56a8-4bbc-94ba-2fdbf7fb4582&signature=Y7VStlORyVL1MqIGfZxjvr30TJw%3D > HTTP/1.1" 200 60 > test_25_add_nw_above_account_limit > (test_add_remove_network.TestAddNetworkToVirtualMachine): DEBUG: Response : > {success : u'true'} > test_25_add_nw_above_account_limit > (test_add_remove_network.TestAddNetworkToVirtualMachine): DEBUG: Payload: > {'signature': 'ObGqa7gqJ+rlKpv4gK66aoX8avk=', 'apiKey': > u'ZI83p8k86jxdFO75d5mjeU5qvLiMvSK2tUnhcSfQc2TDbIJWI4MuvF1w0SkSZ3RB-pykb4VhQaLUVhq6apOqog', > 'command': 'deleteNetworkOffering', 'id': > u'e3a38505-c11d-41cf-b3ed-f0488d50149b', 'response': 'json'} > test_25_add_nw_above_account_limit > (test_add_remove_network.TestAddNetworkToVirtualMachine): DEBUG: > ========Sending GET Cmd : deleteNetworkOffering======= > requests.packages.urllib3.connectionpool: INFO: Starting new HTTP connection > (1): 10.223.130.79 > requests.packages.urllib3.connectionpool: DEBUG: "GET > /client/api?response=json&apiKey=ZI83p8k86jxdFO75d5mjeU5qvLiMvSK2tUnhcSfQc2TDbIJWI4MuvF1w0SkSZ3RB-pykb4VhQaLUVhq6apOqog&command=deleteNetworkOffering&id=e3a38505-c11d-41cf-b3ed-f0488d50149b&signature=ObGqa7gqJ%2BrlKpv4gK66aoX8avk%3D > HTTP/1.1" 431 214 > test_25_add_nw_above_account_limit > (test_add_remove_network.TestAddNetworkToVirtualMachine): ERROR: > Exception:['Traceback (most recent call last):\n', ' File > "/usr/lib/python2.7/site-packages/marvin/cloudstackConnection.py", line 308, > in __parseAndGetResponse\n response_cls)\n', ' File > "/usr/lib/python2.7/site-packages/marvin/jsonHelper.py", line 150, in > getResultObj\n raise cloudstackException.CloudstackAPIException(respname, > errMsg)\n', "CloudstackAPIException: Execute cmd: deletenetworkoffering > failed, due to: errorCode: 431, errorText:Can't delete network offering 59 as > its used by 2 networks. To make the network offering unavaiable, disable > it\n"] > Traceback (most recent call last): > File "/usr/lib/python2.7/site-packages/marvin/cloudstackConnection.py", > line 308, in __parseAndGetResponse > response_cls) > File "/usr/lib/python2.7/site-packages/marvin/jsonHelper.py", line 150, in > getResultObj > raise cloudstackException.CloudstackAPIException(respname, errMsg) > CloudstackAPIException: Execute cmd: deletenetworkoffering failed, due to: > errorCode: 431, errorText:Can't delete network offering 59 as its used by 2 > networks. To make the network offering unavaiable, disable it > test_25_add_nw_above_account_limit > (test_add_remove_network.TestAddNetworkToVirtualMachine): ERROR: > marvinRequest : CmdName: > <marvin.cloudstackAPI.deleteNetworkOffering.deleteNetworkOfferingCmd object > at 0x283d350> Exception: ['Traceback (most recent call last):\n', ' File > "/usr/lib/python2.7/site-packages/marvin/cloudstackConnection.py", line 374, > in marvinRequest\n raise self.__lastError\n', "CloudstackAPIException: > Execute cmd: deletenetworkoffering failed, due to: errorCode: 431, > errorText:Can't delete network offering 59 as its used by 2 networks. To make > the network offering unavaiable, disable it\n"] > Traceback (most recent call last): > File "/usr/lib/python2.7/site-packages/marvin/cloudstackConnection.py", > line 374, in marvinRequest > raise self.__lastError > CloudstackAPIException: Execute cmd: deletenetworkoffering failed, due to: > errorCode: 431, errorText:Can't delete network offering 59 as its used by 2 > networks. To make the network offering unavaiable, disable it > test_25_add_nw_above_account_limit > (test_add_remove_network.TestAddNetworkToVirtualMachine): CRITICAL: > EXCEPTION: test_25_add_nw_above_account_limit: ['Traceback (most recent call > last):\n', ' File "/usr/lib/python2.7/site-packages/nose/suite.py", line > 227, in run\n self.tearDown()\n', ' File > "/usr/lib/python2.7/site-packages/nose/suite.py", line 350, in tearDown\n > self.teardownContext(ancestor)\n', ' File > "/usr/lib/python2.7/site-packages/nose/suite.py", line 366, in > teardownContext\n try_run(context, names)\n', ' File > "/usr/lib/python2.7/site-packages/nose/util.py", line 470, in try_run\n > return func()\n', ' File "/home/chandan/test_add_remove_network.py", line > 280, in tearDownClass\n raise Exception("Warning: Exception during cleanup > : %s" % e)\n', "Exception: Warning: Exception during cleanup : Execute cmd: > deletenetworkoffering failed, due to: errorCode: 431, errorText:Can't delete > network offering 59 as its used by 2 networks. To make the network offering > unavaiable, disable it\n"] > --------------------- >> end captured logging << --------------------- > {Code} -- This message was sent by Atlassian JIRA (v6.2#6252)