test_auth_token_middleware encounters unlimited recursion

Bug #1130200 reported by Alexej Ababilov
28
This bug affects 5 people
Affects Status Importance Assigned to Milestone
python-keystoneclient
Fix Released
High
Alexej Ababilov

Bug Description

test_auth_token_middleware are somehow skipped in OpenStack unit test jobs. These tests fail:

ERROR: tests.test_auth_token_middleware.AuthTokenMiddlewareTest.test_assert_valid_memcache_protection_config
----------------------------------------------------------------------
_StringException: Traceback (most recent call last):
  File "/tmp/yahoo/python-keystoneclient/tests/test_auth_token_middleware.py", line 366, in setUp
    super(BaseAuthTokenMiddlewareTest, self).setUp()
  File "/tmp/yahoo/python-keystoneclient/tests/test_auth_token_middleware.py", line 366, in setUp
    super(BaseAuthTokenMiddlewareTest, self).setUp()
...
  File "/tmp/yahoo/python-keystoneclient/tests/test_auth_token_middleware.py", line 366, in setUp
    super(BaseAuthTokenMiddlewareTest, self).setUp()
  File "/tmp/yahoo/python-keystoneclient/tests/test_auth_token_middleware.py", line 366, in setUp
    super(BaseAuthTokenMiddlewareTest, self).setUp()
RuntimeError: maximum recursion depth exceeded while calling a Python object

The recursion occurs here:

 class BaseAuthTokenMiddlewareTest(testtools.TestCase):

     def setUp(self, expected_env=None):
        super(BaseAuthTokenMiddlewareTest, self).setUp() # calls the same setUp for Python 2.6!
...
if tuple(sys.version_info)[0:2] < (2, 7):

    # 2.6 doesn't have the assert dict equals so make sure that it exists
    class AdjustedBaseAuthTokenMiddlewareTest(BaseAuthTokenMiddlewareTest):
              ....
    BaseAuthTokenMiddlewareTest = AdjustedBaseAuthTokenMiddlewareTest

For Python 2.6, BaseAuthTokenMiddlewareTest will be equal to AdjustedBaseAuthTokenMiddlewareTest in BaseAuthTokenMiddlewareTest.setUp thus leading to infinite recursion.

Also, parent's setUp is called by BaseAuthTokenMiddlewareTest.setUp twice by mistake: at the beginning and at the end of the function.

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

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

Changed in python-keystoneclient:
assignee: nobody → Alessio Ababilov (aababilov)
status: New → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to python-keystoneclient (master)

Reviewed: https://review.openstack.org/22325
Committed: http://github.com/openstack/python-keystoneclient/commit/e844d75277254669a2c029c6536ef0b090524747
Submitter: Jenkins
Branch: master

commit e844d75277254669a2c029c6536ef0b090524747
Author: Alessio Ababilov <email address hidden>
Date: Tue Feb 19 17:58:44 2013 +0200

    Save test_auth_token_middleware from unlimited recursion

    For Python 2.6, BaseAuthTokenMiddlewareTest will be
    equal to AdjustedBaseAuthTokenMiddlewareTest in
    BaseAuthTokenMiddlewareTest.setUp thus leading to
    infinite recursion.

    Also, parent's setUp was incorrectly called by
    BaseAuthTokenMiddlewareTest.setUp twice: at the beginning
    and at the end of the function.

    Change-Id: I63fce65866ef9d8aebe9eb60f7ceb17463de0989
    Fixes: bug #1130200

Changed in python-keystoneclient:
status: In Progress → Fix Committed
Dolph Mathews (dolph)
Changed in python-keystoneclient:
importance: Undecided → High
milestone: none → 0.2.3
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

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