[
https://issues.apache.org/jira/browse/CLOUDSTACK-8008?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Rajani Karuturi updated CLOUDSTACK-8008:
----------------------------------------
Fix Version/s: (was: 4.6.0)
> [Automation] Unable to list project tags using projectId parameter
> ------------------------------------------------------------------
>
> Key: CLOUDSTACK-8008
> URL: https://issues.apache.org/jira/browse/CLOUDSTACK-8008
> Project: CloudStack
> Issue Type: Bug
> Security Level: Public(Anyone can view this level - this is the
> default.)
> Components: Automation
> Affects Versions: 4.5.0
> Reporter: Chandan Purushothama
> Assignee: Prachi Damle
> Fix For: Future
>
>
> Unable to list tags using project id
> ================
> *Test Case Error Log:*
> ================
> {noformat}
> test_15_project_tag (test_tags.TestResourceTags): DEBUG: ::::::::::::STARTED
> : TC: test_15_project_tag :::::::::::
> test_15_project_tag (test_tags.TestResourceTags): DEBUG: Payload: {'apiKey':
> u's8-w4P-KNpZug22P4xScxPGflYEQ77OQEJfIDF6uIkZGXiXp8hKCc1AGMqpMgyWihHuDY80PD7NDks-ZgxqOAQ',
> 'name': 'Project-V0LCNV', 'command': 'createProject', 'signature':
> 'm/TgWlNz5nCZhvQk2ijMmaDal18=', 'displaytext': 'Test project', 'response':
> 'json'}
> test_15_project_tag (test_tags.TestResourceTags): DEBUG: ========Sending GET
> Cmd : createProject=======
> requests.packages.urllib3.connectionpool: INFO: Starting new HTTP connection
> (1): 10.223.130.163
> requests.packages.urllib3.connectionpool: DEBUG: "GET
> /client/api?apiKey=s8-w4P-KNpZug22P4xScxPGflYEQ77OQEJfIDF6uIkZGXiXp8hKCc1AGMqpMgyWihHuDY80PD7NDks-ZgxqOAQ&name=Project-V0LCNV&displaytext=Test+project&signature=m%2FTgWlNz5nCZhvQk2ijMmaDal18%3D&command=createProject&response=json
> HTTP/1.1" 200 122
> test_15_project_tag (test_tags.TestResourceTags): DEBUG: === Jobid:
> 560af5c6-7aab-4e22-8112-69827a6534c1 Started ===
> test_15_project_tag (test_tags.TestResourceTags): DEBUG: Payload:
> {'signature': 'pgHH+YwrPyJJkUaofltWoq/VsJc=', 'apiKey':
> u's8-w4P-KNpZug22P4xScxPGflYEQ77OQEJfIDF6uIkZGXiXp8hKCc1AGMqpMgyWihHuDY80PD7NDks-ZgxqOAQ',
> 'command': 'queryAsyncJobResult', 'response': 'json', 'jobid':
> u'560af5c6-7aab-4e22-8112-69827a6534c1'}
> test_15_project_tag (test_tags.TestResourceTags): DEBUG: ========Sending GET
> Cmd : queryAsyncJobResult=======
> requests.packages.urllib3.connectionpool: INFO: Starting new HTTP connection
> (1): 10.223.130.163
> requests.packages.urllib3.connectionpool: DEBUG: "GET
> /client/api?jobid=560af5c6-7aab-4e22-8112-69827a6534c1&apiKey=s8-w4P-KNpZug22P4xScxPGflYEQ77OQEJfIDF6uIkZGXiXp8hKCc1AGMqpMgyWihHuDY80PD7NDks-ZgxqOAQ&command=queryAsyncJobResult&response=json&signature=pgHH%2BYwrPyJJkUaofltWoq%2FVsJc%3D
> HTTP/1.1" 200 1323
> test_15_project_tag (test_tags.TestResourceTags): DEBUG: Response :
> {jobprocstatus : 0, created : u'2014-12-02T15:36:29-0800', jobresult :
> {primarystorageavailable : u'200', domain : u'ROOT', domainid :
> u'226d5a1a-6e93-11e4-b54b-0689ea0007ab', vpclimit : u'20', iplimit : u'20',
> memorytotal : 0, secondarystorageavailable : u'400', vmtotal : 0, displaytext
> : u'Test project', vpctotal : 0, id :
> u'510ce7d4-6fa1-4fa4-ada9-7362b3774462', networkavailable : u'20',
> networklimit : u'20', iptotal : 0, volumetotal : 0, snapshotlimit : u'20',
> state : u'Active', networktotal : 0, vpcavailable : u'20', cpuavailable :
> u'40', primarystoragetotal : 0, templatelimit : u'20', snapshottotal : 0,
> templateavailable : u'20', vmlimit : u'20', tags : [], volumelimit : u'20',
> templatetotal : 0, memoryavailable : u'40960', secondarystoragetotal : 0,
> account : u'test-TestResourceTags-WNDF0D', secondarystoragelimit : u'400',
> volumeavailable : u'20', name : u'Project-V0LCNV', vmavailable : u'20',
> ipavailable : u'1', memorylimit : u'40960', primarystoragelimit : u'200',
> cputotal : 0, cpulimit : u'40', snapshotavailable : u'20'}, cmd :
> u'org.apache.cloudstack.api.command.user.project.CreateProjectCmd', userid :
> u'173f139b-5379-4f5b-9aee-eefc77362fe7', jobstatus : 1, jobid :
> u'560af5c6-7aab-4e22-8112-69827a6534c1', jobresultcode : 0, jobresulttype :
> u'object', jobinstancetype : u'None', accountid :
> u'96202eae-f933-41f9-ac94-e2ad37cbdfe6'}
> test_15_project_tag (test_tags.TestResourceTags): DEBUG:
> ===Jobid:560af5c6-7aab-4e22-8112-69827a6534c1 ; StartTime:Tue Dec 2 15:36:46
> 2014 ; EndTime:Tue Dec 2 15:36:46 2014 ; TotalTime:0===
> test_15_project_tag (test_tags.TestResourceTags): DEBUG: Response :
> {jobprocstatus : 0, created : u'2014-12-02T15:36:29-0800', jobresult :
> {primarystorageavailable : u'200', domain : u'ROOT', domainid :
> u'226d5a1a-6e93-11e4-b54b-0689ea0007ab', vpclimit : u'20', iplimit : u'20',
> memorytotal : 0, secondarystorageavailable : u'400', vmtotal : 0, displaytext
> : u'Test project', vpctotal : 0, id :
> u'510ce7d4-6fa1-4fa4-ada9-7362b3774462', networkavailable : u'20',
> networklimit : u'20', iptotal : 0, volumetotal : 0, snapshotlimit : u'20',
> state : u'Active', networktotal : 0, vpcavailable : u'20', cpuavailable :
> u'40', primarystoragetotal : 0, templatelimit : u'20', snapshottotal : 0,
> templateavailable : u'20', vmlimit : u'20', tags : [], volumelimit : u'20',
> templatetotal : 0, memoryavailable : u'40960', secondarystoragetotal : 0,
> account : u'test-TestResourceTags-WNDF0D', secondarystoragelimit : u'400',
> volumeavailable : u'20', name : u'Project-V0LCNV', vmavailable : u'20',
> ipavailable : u'1', memorylimit : u'40960', primarystoragelimit : u'200',
> cputotal : 0, cpulimit : u'40', snapshotavailable : u'20'}, cmd :
> u'org.apache.cloudstack.api.command.user.project.CreateProjectCmd', userid :
> u'173f139b-5379-4f5b-9aee-eefc77362fe7', jobstatus : 1, jobid :
> u'560af5c6-7aab-4e22-8112-69827a6534c1', jobresultcode : 0, jobresulttype :
> u'object', jobinstancetype : u'None', accountid :
> u'96202eae-f933-41f9-ac94-e2ad37cbdfe6'}
> test_15_project_tag (test_tags.TestResourceTags): DEBUG: Created project with
> domain admin with ID: 510ce7d4-6fa1-4fa4-ada9-7362b3774462
> test_15_project_tag (test_tags.TestResourceTags): DEBUG: Creating a tag for
> the project
> test_15_project_tag (test_tags.TestResourceTags): DEBUG: Payload: {'apiKey':
> u's8-w4P-KNpZug22P4xScxPGflYEQ77OQEJfIDF6uIkZGXiXp8hKCc1AGMqpMgyWihHuDY80PD7NDks-ZgxqOAQ',
> 'resourcetype': 'project', 'resourceIds':
> u'510ce7d4-6fa1-4fa4-ada9-7362b3774462', 'command': 'createTags',
> 'signature': 'OgXuOQNdnGVg0rKBV4mLXEq5PX0=', 'tags[0].key': 'region',
> 'response': 'json', 'tags[0].value': 'India'}
> test_15_project_tag (test_tags.TestResourceTags): DEBUG: ========Sending GET
> Cmd : createTags=======
> requests.packages.urllib3.connectionpool: INFO: Starting new HTTP connection
> (1): 10.223.130.163
> requests.packages.urllib3.connectionpool: DEBUG: "GET
> /client/api?apiKey=s8-w4P-KNpZug22P4xScxPGflYEQ77OQEJfIDF6uIkZGXiXp8hKCc1AGMqpMgyWihHuDY80PD7NDks-ZgxqOAQ&resourcetype=project&resourceIds=510ce7d4-6fa1-4fa4-ada9-7362b3774462&command=createTags&signature=OgXuOQNdnGVg0rKBV4mLXEq5PX0%3D&tags%5B0%5D.key=region&response=json&tags%5B0%5D.value=India
> HTTP/1.1" 200 75
> test_15_project_tag (test_tags.TestResourceTags): DEBUG: === Jobid:
> 72423346-06d8-4d70-a536-aab48d9364f1 Started ===
> test_15_project_tag (test_tags.TestResourceTags): DEBUG: Payload:
> {'signature': 'diYkRVBtAUIwilewp4hi9w/Wem0=', 'apiKey':
> u's8-w4P-KNpZug22P4xScxPGflYEQ77OQEJfIDF6uIkZGXiXp8hKCc1AGMqpMgyWihHuDY80PD7NDks-ZgxqOAQ',
> 'command': 'queryAsyncJobResult', 'response': 'json', 'jobid':
> u'72423346-06d8-4d70-a536-aab48d9364f1'}
> test_15_project_tag (test_tags.TestResourceTags): DEBUG: ========Sending GET
> Cmd : queryAsyncJobResult=======
> requests.packages.urllib3.connectionpool: INFO: Starting new HTTP connection
> (1): 10.223.130.163
> requests.packages.urllib3.connectionpool: DEBUG: "GET
> /client/api?jobid=72423346-06d8-4d70-a536-aab48d9364f1&apiKey=s8-w4P-KNpZug22P4xScxPGflYEQ77OQEJfIDF6uIkZGXiXp8hKCc1AGMqpMgyWihHuDY80PD7NDks-ZgxqOAQ&command=queryAsyncJobResult&response=json&signature=diYkRVBtAUIwilewp4hi9w%2FWem0%3D
> HTTP/1.1" 200 389
> test_15_project_tag (test_tags.TestResourceTags): DEBUG: Response :
> {jobprocstatus : 0, created : u'2014-12-02T15:36:30-0800', cmd :
> u'org.apache.cloudstack.api.command.user.tag.CreateTagsCmd', userid :
> u'173f139b-5379-4f5b-9aee-eefc77362fe7', jobstatus : 1, jobid :
> u'72423346-06d8-4d70-a536-aab48d9364f1', jobresultcode : 0, jobresulttype :
> u'object', jobresult : {success : True}, accountid :
> u'96202eae-f933-41f9-ac94-e2ad37cbdfe6'}
> test_15_project_tag (test_tags.TestResourceTags): DEBUG:
> ===Jobid:72423346-06d8-4d70-a536-aab48d9364f1 ; StartTime:Tue Dec 2 15:36:47
> 2014 ; EndTime:Tue Dec 2 15:36:47 2014 ; TotalTime:0===
> test_15_project_tag (test_tags.TestResourceTags): DEBUG: Response :
> {jobprocstatus : 0, created : u'2014-12-02T15:36:30-0800', cmd :
> u'org.apache.cloudstack.api.command.user.tag.CreateTagsCmd', userid :
> u'173f139b-5379-4f5b-9aee-eefc77362fe7', jobstatus : 1, jobid :
> u'72423346-06d8-4d70-a536-aab48d9364f1', jobresultcode : 0, jobresulttype :
> u'object', jobresult : {success : True}, accountid :
> u'96202eae-f933-41f9-ac94-e2ad37cbdfe6'}
> test_15_project_tag (test_tags.TestResourceTags): DEBUG: Tag created:
> {'success': True}
> test_15_project_tag (test_tags.TestResourceTags): DEBUG: Payload: {'apiKey':
> u's8-w4P-KNpZug22P4xScxPGflYEQ77OQEJfIDF6uIkZGXiXp8hKCc1AGMqpMgyWihHuDY80PD7NDks-ZgxqOAQ',
> 'projectid': u'510ce7d4-6fa1-4fa4-ada9-7362b3774462', 'command': 'listTags',
> 'signature': 'DBH68ZyJNXtHxhFrKVZ+OXSAwPo=', 'response': 'json', 'listall':
> True}
> test_15_project_tag (test_tags.TestResourceTags): DEBUG: ========Sending GET
> Cmd : listTags=======
> requests.packages.urllib3.connectionpool: INFO: Starting new HTTP connection
> (1): 10.223.130.163
> requests.packages.urllib3.connectionpool: DEBUG: "GET
> /client/api?apiKey=s8-w4P-KNpZug22P4xScxPGflYEQ77OQEJfIDF6uIkZGXiXp8hKCc1AGMqpMgyWihHuDY80PD7NDks-ZgxqOAQ&projectid=510ce7d4-6fa1-4fa4-ada9-7362b3774462&command=listTags&signature=DBH68ZyJNXtHxhFrKVZ%2BOXSAwPo%3D&response=json&listall=True
> HTTP/1.1" 200 28
> test_15_project_tag (test_tags.TestResourceTags): DEBUG: Response : None
> test_15_project_tag (test_tags.TestResourceTags): DEBUG: tags = None
> test_15_project_tag (test_tags.TestResourceTags): CRITICAL: FAILED:
> test_15_project_tag: ['Traceback (most recent call last):\n', ' File
> "/usr/lib/python2.7/unittest/case.py", line 329, in run\n testMethod()\n',
> ' File "/home/Chandan/test_tags.py", line 1720, in test_15_project_tag\n
> "List tags should not return empty response"\n', ' File
> "/usr/lib/python2.7/unittest/case.py", line 513, in assertEqual\n
> assertion_func(first, second, msg=msg)\n', ' File
> "/usr/lib/python2.7/unittest/case.py", line 506, in _baseAssertEqual\n
> raise self.failureException(msg)\n', 'AssertionError: List tags should not
> return empty response\n']
> --------------------- >> end captured logging << ---------------------
> ----------------------------------------------------------------------
> Ran 1 test in 269.646s
> FAILED (failures=1)
> {noformat}
> ===============
> *Test Client Code:*
> ===============
> {code}
> @attr(tags=["advanced"], required_hardware="false")
> def test_15_project_tag(self):
> """ Test creation, listing and deletion tags on projects
> """
> # Validate the following
> # 1. Create a new project
> # 2. Create a tag on projects using createTags API
> # 3. Delete the tag.
> # Create project as a domain admin
> project = Project.create(
> self.user_api_client,
> self.services["project"]
> )
> # Cleanup created project at end of test
> self.cleanup.append(project)
> self.debug("Created project with domain admin with ID: %s" %
> project.id)
> self.debug("Creating a tag for the project")
> tag = Tag.create(
> self.user_api_client,
> resourceIds=project.id,
> resourceType='project',
> tags={'region': 'India'}
> )
> self.debug("Tag created: %s" % tag.__dict__)
> tags = Tag.list(
> self.user_api_client,
> listall=True,
> projectid=project.id
> )
> self.debug("tags = %s" % tags)
>
> self.assertEqual(
> isinstance(tags, list),
> True,
> "List tags should not return empty response"
> )
> self.assertEqual(
> tags[0].value,
> 'India',
> 'The tag should have original value'
> )
>
> projects = Project.list(
> self.user_api_client,
> listall=True,
> key='region',
> value='India'
> )
> self.assertEqual(
> isinstance(projects, list),
> True,
> "List Project should return valid list"
> )
> self.debug("Deleting the created tag..")
> try:
> tag.delete(
> self.user_api_client,
> resourceIds=project.id,
> resourceType='project',
> tags={'region': 'India'}
> )
> except Exception as e:
> self.fail("Failed to delete the tag - %s" % e)
> self.debug("Verifying if tag is actually deleted!")
> tags = Tag.list(
> self.user_api_client,
> listall=True,
> resourceType='project',
> account=self.account.name,
> domainid=self.account.domainid,
> key='region',
> value='India'
> )
> self.assertEqual(
> tags,
> None,
> "List tags should return empty response"
> )
> return
> {code}
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)