Get no resource_name when running the list_resource_types function.

Bug #1807559 reported by Liu Xiaolei
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
tempest
Invalid
Undecided
Soumya Purohit

Bug Description

If glance does not have any resource type association,we will get IndexError when getting resource_name from list_resource_types function's response body because the function response body does not have any resource_types.

This bug is associated with three cases:
1).api/image/v2/test_images_metadefs_namespace_properties.py:MetadataNamespacePropertiesTest.test_basic_meta_def_namespace_property
2).api/image/v2/test_images_metadefs_resource_types.py:MetadataResourceTypesTest.test_basic_meta_def_resource_type_association
3).api/image/v2/test_images_metadefs_namespaces.py:MetadataNamespacesTest.test_basic_metadata_definition_namespaces

You can recurrence the bug by below actions:
1).[root@controller ~]# glance md-resource-type-list
+------+
| name |
+------+
+------+
2).[root@controller v2]# nosetests -v test_images_metadefs_namespaces.py:
tempest.api.image.v2.test_images_metadefs_namespaces.MetadataNamespacesTest.test_basic_metadata_definition_namespaces[id-319b765e-7f3d-4b3d-8b37-3ca3876ee768] ... ERROR
Traceback (most recent call last):
  File "/root/tempest-pike/tempest/api/image/v2/test_images_metadefs_namespaces.py", line 31, in test_basic_metadata_definition_namespaces
    resource_name = body['resource_types'][0]['name']
IndexError: list index out of range

This error happens because the body does not have any resource_types.

We should judge whether the list_resource_types response body contains resource_types before getting the resource_name.If there is no resource_types,we shoule set one initialized resource_name to getting the test going on.

Liu Xiaolei (hysen)
Changed in tempest:
assignee: nobody → Liu Xiaolei (hysen)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to tempest (master)

Fix proposed to branch: master
Review: https://review.openstack.org/623924

Changed in tempest:
status: New → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Change abandoned on tempest (master)

Change abandoned by Liu Xiaolei (<email address hidden>) on branch: master
Review: https://review.openstack.org/623924

Soumya Purohit (sp545d)
Changed in tempest:
assignee: Liu Xiaolei (hysen) → nobody
assignee: nobody → Soumya Purohit (sp545d)
Revision history for this message
Soumya Purohit (sp545d) wrote :

Rather than assigning a random value to resource name a skip check can be added if the deployment does not have image metadata. If the resource_types is empty and we can skip the test.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote :

Change abandoned by Soumya Purohit (<email address hidden>) on branch: master
Review: https://review.opendev.org/672346
Reason: Abandoning as blacklisted in downstream CI

Revision history for this message
Doug Schveninger (ds6901) wrote :

Since having no metadata defined is a deployment choice we have decided this better to abandon Soumya PS and handle this through blacklist in the downstream CI

Revision history for this message
Doug Schveninger (ds6901) wrote :

We can close this bug

Changed in tempest:
status: In Progress → Invalid
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.