[
https://issues.apache.org/jira/browse/CLOUDSTACK-7127?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Gaurav Aradhye resolved CLOUDSTACK-7127.
----------------------------------------
Resolution: Fixed
> Fix test_regions.py script - addregion failed, Region with id: 1 already
> exists
> --------------------------------------------------------------------------------
>
> Key: CLOUDSTACK-7127
> URL: https://issues.apache.org/jira/browse/CLOUDSTACK-7127
> Project: CloudStack
> Issue Type: Test
> Security Level: Public(Anyone can view this level - this is the
> default.)
> Components: Management Server
> Affects Versions: 4.5.0
> Reporter: Chandan Purushothama
> Assignee: Gaurav Aradhye
> Priority: Critical
> Fix For: 4.5.0
>
>
> ===========================
> Code Snippet from test_regions.py:
> ===========================
> def setUp(self):
> pseudo_random_int = choice(xrange(1, 200)) <-- BUG: Region with ID=1
> already exists on the CloudStack Setup. In case if 1 is chosen the testsuite
> fails to execute.
> self.services["region"]["regionid"] = pseudo_random_int
> self.services["region"]["regionname"] = "region" +
> str(pseudo_random_int)
> self.services["region"]["regionendpoint"] = "http://region" +
> str(pseudo_random_int) + ":8080/client"
> self.region = Region.create(self.api_client,
> self.services["region"]
> )
> Secondly, setup method code should be placed in try and catch blocks
> =========
> Test Error:
> =========
> Error Message:
> Execute cmd: addregion failed, due to: errorCode: 431, errorText:Region with
> id: 1 already exists
> -------------------- >> begin captured stdout << ---------------------
> === TestName: test_createRegionWithExistingRegionName | Status : EXCEPTION ===
> --------------------- >> end captured stdout << ----------------------
> -------------------- >> begin captured logging << --------------------
> test_createRegionWithExistingRegionName
> (integration.component.test_regions.TestRegions): DEBUG: ::::::::::::STARTED
> : TC: test_createRegionWithExistingRegionName :::::::::::
> test_createRegionWithExistingRegionName
> (integration.component.test_regions.TestRegions): DEBUG: Payload:
> {'endpoint': 'http://region1:8080/client', 'name': 'region1', 'id': 1,
> 'apiKey':
> u'Ra1mlXzCZU0K1l4MKDWdRbQDU67PCQuRnKYv3hyc-Q8hSvCSFjB32UtifLbS6oYpMeKaf0BCuUidMw0LqZeCMA',
> 'command': 'addRegion', 'signature': 'jZQivyHVubuotqAzSjRPxUJmAn4=',
> 'response': 'json'}
> test_createRegionWithExistingRegionName
> (integration.component.test_regions.TestRegions): DEBUG: ========Sending GET
> Cmd : addRegion=======
> requests.packages.urllib3.connectionpool: INFO: Starting new HTTP connection
> (1): 10.220.135.73
> requests.packages.urllib3.connectionpool: DEBUG: "GET
> /client/api?endpoint=http%3A%2F%2Fregion1%3A8080%2Fclient&name=region1&id=1&apiKey=Ra1mlXzCZU0K1l4MKDWdRbQDU67PCQuRnKYv3hyc-Q8hSvCSFjB32UtifLbS6oYpMeKaf0BCuUidMw0LqZeCMA&command=addRegion&signature=jZQivyHVubuotqAzSjRPxUJmAn4%3D&response=json
> HTTP/1.1" 431 123
> test_createRegionWithExistingRegionName
> (integration.component.test_regions.TestRegions): ERROR:
> Exception:['Traceback (most recent call last):\n', ' File
> "/local/jenkins/workspace/xenrt-reg-basic-xs/work.64/env/local/lib/python2.7/site-packages/marvin/cloudstackConnection.py",
> line 308, in __parseAndGetResponse\n response_cls)\n', ' File
> "/local/jenkins/workspace/xenrt-reg-basic-xs/work.64/env/local/lib/python2.7/site-packages/marvin/jsonHelper.py",
> line 150, in getResultObj\n raise
> cloudstackException.CloudstackAPIException(respname, errMsg)\n',
> 'CloudstackAPIException: Execute cmd: addregion failed, due to: errorCode:
> 431, errorText:Region with id: 1 already exists\n']
> Traceback (most recent call last):
> File
> "/local/jenkins/workspace/xenrt-reg-basic-xs/work.64/env/local/lib/python2.7/site-packages/marvin/cloudstackConnection.py",
> line 308, in __parseAndGetResponse
> response_cls)
> File
> "/local/jenkins/workspace/xenrt-reg-basic-xs/work.64/env/local/lib/python2.7/site-packages/marvin/jsonHelper.py",
> line 150, in getResultObj
> raise cloudstackException.CloudstackAPIException(respname, errMsg)
> CloudstackAPIException: Execute cmd: addregion failed, due to: errorCode:
> 431, errorText:Region with id: 1 already exists
> test_createRegionWithExistingRegionName
> (integration.component.test_regions.TestRegions): ERROR: marvinRequest :
> CmdName: <marvin.cloudstackAPI.addRegion.addRegionCmd object at 0x3341e50>
> Exception: ['Traceback (most recent call last):\n', ' File
> "/local/jenkins/workspace/xenrt-reg-basic-xs/work.64/env/local/lib/python2.7/site-packages/marvin/cloudstackConnection.py",
> line 375, in marvinRequest\n raise self.__lastError\n',
> 'CloudstackAPIException: Execute cmd: addregion failed, due to: errorCode:
> 431, errorText:Region with id: 1 already exists\n']
> Traceback (most recent call last):
> File
> "/local/jenkins/workspace/xenrt-reg-basic-xs/work.64/env/local/lib/python2.7/site-packages/marvin/cloudstackConnection.py",
> line 375, in marvinRequest
> raise self.__lastError
> CloudstackAPIException: Execute cmd: addregion failed, due to: errorCode:
> 431, errorText:Region with id: 1 already exists
> test_createRegionWithExistingRegionName
> (integration.component.test_regions.TestRegions): CRITICAL: EXCEPTION:
> test_createRegionWithExistingRegionName: ['Traceback (most recent call
> last):\n', ' File "/usr/lib/python2.7/unittest/case.py", line 323, in run\n
> self.setUp()\n', ' File
> "/home/jenkins/workspace/xenrt-reg-basic-xs/cloudstack.git/test/integration/component/test_regions.py",
> line 55, in setUp\n self.services["region"]\n', ' File
> "/local/jenkins/workspace/xenrt-reg-basic-xs/work.64/env/local/lib/python2.7/site-packages/marvin/lib/base.py",
> line 4311, in create\n raise e\n', 'CloudstackAPIException: Execute cmd:
> addregion failed, due to: errorCode: 431, errorText:Region with id: 1 already
> exists\n']
> --------------------- >> end captured logging << ---------------------
> Stacktrace
> File "/usr/lib/python2.7/unittest/case.py", line 323, in run
> self.setUp()
> File
> "/home/jenkins/workspace/xenrt-reg-basic-xs/cloudstack.git/test/integration/component/test_regions.py",
> line 55, in setUp
> self.services["region"]
> File
> "/local/jenkins/workspace/xenrt-reg-basic-xs/work.64/env/local/lib/python2.7/site-packages/marvin/lib/base.py",
> line 4311, in create
> raise e
> 'Execute cmd: addregion failed, due to: errorCode: 431, errorText:Region with
> id: 1 already exists\n-------------------- >> begin captured stdout <<
> ---------------------\n=== TestName: test_createRegionWithExistingRegionName
> | Status : EXCEPTION ===\n\n\n--------------------- >> end captured stdout <<
> ----------------------\n-------------------- >> begin captured logging <<
> --------------------\ntest_createRegionWithExistingRegionName
> (integration.component.test_regions.TestRegions): DEBUG: ::::::::::::STARTED
> : TC: test_createRegionWithExistingRegionName
> :::::::::::\ntest_createRegionWithExistingRegionName
> (integration.component.test_regions.TestRegions): DEBUG: Payload:
> {\'endpoint\': \'http://region1:8080/client\', \'name\': \'region1\', \'id\':
> 1, \'apiKey\':
> u\'Ra1mlXzCZU0K1l4MKDWdRbQDU67PCQuRnKYv3hyc-Q8hSvCSFjB32UtifLbS6oYpMeKaf0BCuUidMw0LqZeCMA\',
> \'command\': \'addRegion\', \'signature\': \'jZQivyHVubuotqAzSjRPxUJmAn4=\',
> \'response\': \'json\'}\ntest_createRegionWithExistingRegionName
> (integration.component.test_regions.TestRegions): DEBUG: ========Sending GET
> Cmd : addRegion=======\nrequests.packages.urllib3.connectionpool: INFO:
> Starting new HTTP connection (1):
> 10.220.135.73\nrequests.packages.urllib3.connectionpool: DEBUG: "GET
> /client/api?endpoint=http%3A%2F%2Fregion1%3A8080%2Fclient&name=region1&id=1&apiKey=Ra1mlXzCZU0K1l4MKDWdRbQDU67PCQuRnKYv3hyc-Q8hSvCSFjB32UtifLbS6oYpMeKaf0BCuUidMw0LqZeCMA&command=addRegion&signature=jZQivyHVubuotqAzSjRPxUJmAn4%3D&response=json
> HTTP/1.1" 431 123\ntest_createRegionWithExistingRegionName
> (integration.component.test_regions.TestRegions): ERROR:
> Exception:[\'Traceback (most recent call last):\\n\', \' File
> "/local/jenkins/workspace/xenrt-reg-basic-xs/work.64/env/local/lib/python2.7/site-packages/marvin/cloudstackConnection.py",
> line 308, in __parseAndGetResponse\\n response_cls)\\n\', \' File
> "/local/jenkins/workspace/xenrt-reg-basic-xs/work.64/env/local/lib/python2.7/site-packages/marvin/jsonHelper.py",
> line 150, in getResultObj\\n raise
> cloudstackException.CloudstackAPIException(respname, errMsg)\\n\',
> \'CloudstackAPIException: Execute cmd: addregion failed, due to: errorCode:
> 431, errorText:Region with id: 1 already exists\\n\']\nTraceback (most recent
> call last):\n File
> "/local/jenkins/workspace/xenrt-reg-basic-xs/work.64/env/local/lib/python2.7/site-packages/marvin/cloudstackConnection.py",
> line 308, in __parseAndGetResponse\n response_cls)\n File
> "/local/jenkins/workspace/xenrt-reg-basic-xs/work.64/env/local/lib/python2.7/site-packages/marvin/jsonHelper.py",
> line 150, in getResultObj\n raise
> cloudstackException.CloudstackAPIException(respname,
> errMsg)\nCloudstackAPIException: Execute cmd: addregion failed, due to:
> errorCode: 431, errorText:Region with id: 1 already
> exists\ntest_createRegionWithExistingRegionName
> (integration.component.test_regions.TestRegions): ERROR: marvinRequest :
> CmdName: <marvin.cloudstackAPI.addRegion.addRegionCmd object at 0x3341e50>
> Exception: [\'Traceback (most recent call last):\\n\', \' File
> "/local/jenkins/workspace/xenrt-reg-basic-xs/work.64/env/local/lib/python2.7/site-packages/marvin/cloudstackConnection.py",
> line 375, in marvinRequest\\n raise self.__lastError\\n\',
> \'CloudstackAPIException: Execute cmd: addregion failed, due to: errorCode:
> 431, errorText:Region with id: 1 already exists\\n\']\nTraceback (most recent
> call last):\n File
> "/local/jenkins/workspace/xenrt-reg-basic-xs/work.64/env/local/lib/python2.7/site-packages/marvin/cloudstackConnection.py",
> line 375, in marvinRequest\n raise
> self.__lastError\nCloudstackAPIException: Execute cmd: addregion failed, due
> to: errorCode: 431, errorText:Region with id: 1 already
> exists\ntest_createRegionWithExistingRegionName
> (integration.component.test_regions.TestRegions): CRITICAL: EXCEPTION:
> test_createRegionWithExistingRegionName: [\'Traceback (most recent call
> last):\\n\', \' File "/usr/lib/python2.7/unittest/case.py", line 323, in
> run\\n self.setUp()\\n\', \' File
> "/home/jenkins/workspace/xenrt-reg-basic-xs/cloudstack.git/test/integration/component/test_regions.py",
> line 55, in setUp\\n self.services["region"]\\n\', \' File
> "/local/jenkins/workspace/xenrt-reg-basic-xs/work.64/env/local/lib/python2.7/site-packages/marvin/lib/base.py",
> line 4311, in create\\n raise e\\n\', \'CloudstackAPIException: Execute
> cmd: addregion failed, due to: errorCode: 431, errorText:Region with id: 1
> already exists\\n\']\n--------------------- >> end captured logging <<
> ---------------------'
--
This message was sent by Atlassian JIRA
(v6.2#6252)