tenant dictionary passed to (SQL)Identity.create_tenant is modified

Bug #1066851 reported by Ionuț Arțăriși
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Identity (keystone)
Fix Released
Undecided
Ionuț Arțăriși

Bug Description

The Tenant.to_dict method of the SQL backend adds an 'extra' key in the tenant dictionary that was passed to create_tenant.

This is apparent only when running the SQL tests before the LDAP ones:

nosetests -s tests/test_backend_sql.py:SqlIdentity.test_authenticate tests/test_backend_ldap.py:LDAPIdentity.test_authenticate

======================================================================
FAIL: test_authenticate (test_backend_ldap.LDAPIdentity)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/var/lib/openstack-keystone-test/tests/test_backend.py", line 67, in test_authenticate
    self.assertDictEquals(tenant_ref, self.tenant_bar)
  File "/var/lib/openstack-keystone-test/keystone/test.py", line 305, in assertDictEquals
    'Expected key %s not in %s.' % (k, actual))
AssertionError: Expected key extra not in {'id': 'bar', 'name': 'BAR'}.
-------------------- >> begin captured logging << --------------------
~~ snipped lots of LDAP logs ~~

Running them in the usual alphabetic order, doesn't show any errors (nosetests -s tests/test_backend_ldap.py:LDAPIdentity.test_authenticate tests/test_backend_sql.py:SqlIdentity.test_authenticate)

The simple fix is to pass a copy of the tenant fixture to create_tenant in the load_fixtures function. OTOH is this really the proper functionality for the Identity backend? i.e. modifying the dictionary passed in to create_tenant?

The fix is trivial for both cases, so I'd just like a second opinion on where to fix it: keystone.test vs keystone.identity.backends.sql

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to keystone (master)

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

Changed in keystone:
assignee: nobody → Ionuț Arțăriși (mapleoin)
status: New → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to keystone (master)

Reviewed: https://review.openstack.org/14472
Committed: http://github.com/openstack/keystone/commit/fdcb856b138cbda4b68efa83354b98f558269371
Submitter: Jenkins
Branch: master

commit fdcb856b138cbda4b68efa83354b98f558269371
Author: Ionuț Arțăriși <email address hidden>
Date: Tue Oct 16 10:58:50 2012 +0200

    don't modify the passed in dict to from_dict

    Fixes bug 1066851

    Change-Id: Ic1f44ba1e319b9cd7e3f1da535f9d29ae7dc4030

Changed in keystone:
status: In Progress → Fix Committed
Thierry Carrez (ttx)
Changed in keystone:
milestone: none → grizzly-1
status: Fix Committed → Fix Released
Thierry Carrez (ttx)
Changed in keystone:
milestone: grizzly-1 → 2013.1
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.