test_get_image_members_not_existing unit failure

Bug #1205091 reported by Brian Elliott
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Glance
Fix Released
Undecided
Brian Elliott

Bug Description

The following error is disguised by "self.stubs" getting assigned in 3 different places in the test class setup for TestRegistryV1Client.

This error would only manifest if the original self.stubs in glance.tests.utils.BaseTestCase got GC'd and the __del__ method in stubout.StubOutForTesting unset all the stubs, including the one that enabled _FATAL_EXCEPTION_FORMAT_ERRORS. Without _FATAL_EXCEPTION_FORMAT_ERRORS == True, the message formatting error in the exception got silently swallowed.

======================================================================
ERROR: glance.tests.unit.v1.test_registry_client.TestRegistryV1Client.test_get_image_members_not_existing
----------------------------------------------------------------------
_StringException: Traceback (most recent call last):
  File "/home/bde/glance/glance/tests/unit/v1/test_registry_client.py", line 1165, in test_get_image_members_not_existing
    _gen_uuid())
  File "/home/bde/glance/.venv/local/lib/python2.7/site-packages/testtools/testcase.py", line 394, in assertRaises
    self.assertThat(our_callable, matcher)
  File "/home/bde/glance/.venv/local/lib/python2.7/site-packages/testtools/testcase.py", line 406, in assertThat
    mismatch = matcher.match(matchee)
  File "/home/bde/glance/.venv/local/lib/python2.7/site-packages/testtools/matchers/_exception.py", line 99, in match
    mismatch = self.exception_matcher.match(exc_info)
  File "/home/bde/glance/.venv/local/lib/python2.7/site-packages/testtools/matchers/_higherorder.py", line 61, in match
    mismatch = matcher.match(matchee)
  File "/home/bde/glance/.venv/local/lib/python2.7/site-packages/testtools/testcase.py", line 386, in match
    reraise(*matchee)
  File "/home/bde/glance/.venv/local/lib/python2.7/site-packages/testtools/matchers/_exception.py", line 92, in match
    result = matchee()
  File "/home/bde/glance/.venv/local/lib/python2.7/site-packages/testtools/testcase.py", line 867, in __call__
    return self._callable_object(*self._args, **self._kwargs)
  File "/home/bde/glance/glance/registry/client/v1/client.py", line 186, in get_image_members
    res = self.do_request("GET", "/images/%s/members" % image_id)
  File "/home/bde/glance/glance/registry/client/v1/client.py", line 93, in do_request
    **kwargs)
  File "/home/bde/glance/glance/common/client.py", line 64, in wrapped
    return func(self, *args, **kwargs)
  File "/home/bde/glance/glance/common/client.py", line 383, in do_request
    headers=copy.deepcopy(headers))
  File "/home/bde/glance/glance/common/client.py", line 81, in wrapped
    return func(self, method, url, body, headers)
  File "/home/bde/glance/glance/common/client.py", line 528, in _do_request
    raise exception.NotFound(res.read())
  File "/home/bde/glance/glance/common/exception.py", line 45, in __init__
    message = message % kwargs
KeyError: 'id'

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

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

Changed in glance:
assignee: nobody → Brian Elliott (belliott)
status: New → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to glance (master)

Reviewed: https://review.openstack.org/38696
Committed: http://github.com/openstack/glance/commit/53df2c0b528f85060da5075a4e209ec1bee9e0ac
Submitter: Jenkins
Branch: master

commit 53df2c0b528f85060da5075a4e209ec1bee9e0ac
Author: Brian Elliott <email address hidden>
Date: Thu Jul 18 23:06:03 2013 +0000

    Fix stubs setup and exception message formatting

    Fixes time-dependent bug in test case stubs setup that could result
    in stubs being unset by GC.

    bug 1205091

    Change-Id: Ic0d97bd1f96e42631c1ba3e1eaf4cf74b36140b2

Changed in glance:
status: In Progress → Fix Committed
Thierry Carrez (ttx)
Changed in glance:
milestone: none → havana-3
status: Fix Committed → Fix Released
Thierry Carrez (ttx)
Changed in glance:
milestone: havana-3 → 2013.2
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.