Race condition in unit.test_commands.TestCreateTokenCommand

Bug #921634 reported by Ralf Haferkamp
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Identity (keystone)
Fix Released
Low
Unassigned

Bug Description

I get test failures from unit.test_commands.TestCreateTokenCommand sometimes. The test output in such a case is:

======================================================================
FAIL: test_create_unscoped_token (keystone.test.unit.test_commands.TestCreateTokenCommand)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/root/keystone/keystone/test/unit/test_commands.py", line 841, in test_create_unscoped_token
    str(None), self.tomorrow])
  File "/root/keystone/keystone/test/unit/test_commands.py", line 113, in assertTableContainsRow
    self.assertEquals(row, matching_row)
AssertionError: Lists differ: ['96d218ac8e15428a8894d5d8cab1... != [u'96d218ac8e15428a8894d5d8cab...

First differing element 3:
2012-01-26T15:39
2012-01-26T15:40

- ['96d218ac8e15428a8894d5d8cab16809',
+ [u'96d218ac8e15428a8894d5d8cab16809',
? +

- '30427734c2394284bb2965dd77b12313',
+ u'30427734c2394284bb2965dd77b12313',
? +

- 'None',
+ u'None',
? +

- '2012-01-26T15:39']
? ^^

+ u'2012-01-26T15:40']
? + ^^
======================================================================

This seems to be a race-condition. The above test run was started at 15:39:59 but the create_token command was run on 15:40:00. Because of this timestamp in the token datebase doesn't match the expected value.

I'll try to come up with a patch.

Dolph Mathews (dolph)
Changed in keystone:
importance: Undecided → Low
status: New → Confirmed
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to keystone (milestone-proposed)

Fix proposed to branch: milestone-proposed
Review: https://review.openstack.org/3410

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

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

commit d1a3c5fa96928b05c3ecdbd8fa5be4bd12fb33ff
Author: Ralf Haferkamp <email address hidden>
Date: Wed Jan 25 16:51:52 2012 +0100

    Fix race in TestCreateTokenCommand (bug 921634)

    This fix should reduce the possiblity of failure significantly.

    Change-Id: I3a1a7d4eafd11ee8c73a97c45c3f9c38a63a0df0

Changed in keystone:
status: Confirmed → Fix Committed
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to keystone (milestone-proposed)

Reviewed: https://review.openstack.org/3410
Committed: http://github.com/openstack/keystone/commit/8cc0d3647a69912ebe5917314f5b0dfe62a733af
Submitter: Jenkins
Branch: milestone-proposed

commit 8cc0d3647a69912ebe5917314f5b0dfe62a733af
Author: Ralf Haferkamp <email address hidden>
Date: Wed Jan 25 16:51:52 2012 +0100

    Document & reduce potential for race condition (bug 921634)

    Change-Id: Id2925ba0fb956165abba2f786528ff98c17c24cb

Changed in keystone:
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.