test_add_image_member got MismatchError

Bug #1606096 reported by zhufl
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
tempest
Fix Released
Undecided
zhufl

Bug Description

When using pre-provisioned credentials(set use_dynamic_credentials=False in tempest.conf),
running test_add_image_member got MismatchError: None not in [u'None']

  Traceback (most recent call last):
    File "/home/tempest-latest/tempest_m/tempest/api/image/v1/test_image_members.py", line 29, in test_add_image_member
      self.assertIn(self.alt_tenant_id, members)
    File "/usr/lib/python2.7/site-packages/testtools/testcase.py", line 354, in assertIn
      self.assertThat(haystack, Contains(needle), message)
    File "/usr/lib/python2.7/site-packages/testtools/testcase.py", line 433, in assertThat
      raise mismatch_error
  MismatchError: None not in [u'None']

The reason is:
   When using pre-provisioned credentials, validating is done when the client sends its first request. So tenant_id is None before the client sends its first request.

Detail debug info:
   (1) tenant_id is None in PUT request
       204 PUT http://10.43.211.177:9292/v1/images/02f21ce5-fbe5-43db-8f21-491b3982b554/members/None

   (2) member_id is "None" in GET response
       200 GET http://10.43.211.177:9292/v1/images/02f21ce5-fbe5-43db-8f21-491b3982b554/members

       Request-Head: {}
            Request-Body: None

       Response-Head: {'status': '200', 'content-length': '56'}
            Response-Body: {"members": [{"can_share": false, "member_id": "None"}]}

zhufl (zhu-fanglei)
Changed in tempest:
status: New → In Progress
assignee: nobody → zhufl (zhu-fanglei)
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/346564

Revision history for this message
Ghanshyam Mann (ghanshyammann) wrote :

I feel tenant_id/project_id should be mentioned in account.yaml

Currently account_generator does not dump the tenant_id/project_id in generated file so we can add there.

Revision history for this message
zhufl (zhu-fanglei) wrote :

tenant_name is mentioned in account.yaml. It seems from Andrea Frittoli' commit
"Prepare cred_client for migration"(8 Oct 2015), tenant_id no longer populates in
the beginning.

https://github.com/openstack/tempest/commit/278463cae0510e7f5e120e542742dcc4c4cf373b

     def get_credentials(self, user, project, password):
- return cred_provider.get_credentials(
+ # User and project already include both ID and name here,
+ # so there's no need to use the fill_in mode
+ return auth.get_credentials(
+ auth_url=None,
+ fill_in=False,
             identity_version='v2',
             username=user['name'], user_id=user['id'],
             tenant_name=project['name'], tenant_id=project['id'],

I have tried to run test_add_image_member and it is sure to get "MismatchError: None not in [u'None']".

If there is some reason that pre-provisioned credentials shouldn't populate tenant_id in the beginning, then the simplest way to erase the testcase error seems to let the client make a call.
(Testcases other than image have no problem, so we need only modify api/image/base.py)

Revision history for this message
Andrea Frittoli (andrea-frittoli) wrote :
Changed in tempest:
status: In Progress → Fix Committed
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Change abandoned on tempest (master)

Change abandoned by zhufl (<email address hidden>) on branch: master
Review: https://review.openstack.org/346564
Reason: ok

Revision history for this message
Ken'ichi Ohmichi (oomichi) wrote :

A new Tempest has been released after this bug fixed.

Changed in tempest:
status: Fix Committed → Fix Released
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.