← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1603979] Re: gate: context tests failed because missing parameter "is_admin_project" (oslo.context 2.6.0)

 

Looks like https://review.openstack.org/#/c/345633/ solved this issue. I see no hits in logstash in the last 24 hours:
Logstash query: http://logstash.openstack.org/#/dashboard/file/logstash.json?from=7d&query=build_name:gate-nova-python27-db%20AND%20message:%5C%22testtools.matchers._impl.MismatchError:%200%20!%3D%201:%20%5B%5C%22Arguments%20dropped%20when%20creating%20context:%20%7B'is_admin_project':%20True%7D%5C%22%5D%5C%22

** Changed in: nova
       Status: In Progress => Fix Released

-- 
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to OpenStack Compute (nova).
https://bugs.launchpad.net/bugs/1603979

Title:
  gate: context tests failed because missing parameter
  "is_admin_project" (oslo.context 2.6.0)

Status in OpenStack Compute (nova):
  Fix Released

Bug description:
  Description
  ===========
  The following 3 tests failed:
  1. nova.tests.unit.test_context.ContextTestCase.test_convert_from_dict_then_to_dict
  Captured traceback:
  ~~~~~~~~~~~~~~~~~~~
      Traceback (most recent call last):
        File "nova/tests/unit/test_context.py", line 230, in test_convert_from_dict_then_to_dict
          self.assertEqual(values, values2)
        File "/opt/stack/nova/.tox/py27/lib/python2.7/site-packages/testtools/testcase.py", line 411, in assertEqual
          self.assertThat(observed, matcher, message)
        File "/opt/stack/nova/.tox/py27/lib/python2.7/site-packages/testtools/testcase.py", line 498, in assertThat
          raise mismatch_error
      testtools.matchers._impl.MismatchError: !=:
      reference = {
       ......
       'is_admin': True,
       ......}
      actual    = {
       ......
       'is_admin': True,
       'is_admin_project': True,
       ......}

  2. nova.tests.unit.test_context.ContextTestCase.test_convert_from_rc_to_dict
  Captured traceback:
  ~~~~~~~~~~~~~~~~~~~
      Traceback (most recent call last):
        File "nova/tests/unit/test_context.py", line 203, in test_convert_from_rc_to_dict
          self.assertEqual(expected_values, values2)
        File "/opt/stack/nova/.tox/py27/lib/python2.7/site-packages/testtools/testcase.py", line 411, in assertEqual
          self.assertThat(observed, matcher, message)
        File "/opt/stack/nova/.tox/py27/lib/python2.7/site-packages/testtools/testcase.py", line 498, in assertThat
          raise mismatch_error
      testtools.matchers._impl.MismatchError: !=:
      reference = {
       ......
       'is_admin': True,
       ......}
      actual    = {
       ......
       'is_admin': True,
       'is_admin_project': True,
       ......}

  3. nova.tests.unit.test_context.ContextTestCase.test_to_dict_from_dict_no_log
  Captured traceback:
  ~~~~~~~~~~~~~~~~~~~
      Traceback (most recent call last):
        File "nova/tests/unit/test_context.py", line 144, in test_to_dict_from_dict_no_log
          self.assertEqual(0, len(warns), warns)
        File "/opt/stack/nova/.tox/py27/lib/python2.7/site-packages/testtools/testcase.py", line 411, in assertEqual
          self.assertThat(observed, matcher, message)
        File "/opt/stack/nova/.tox/py27/lib/python2.7/site-packages/testtools/testcase.py", line 498, in assertThat
          raise mismatch_error
      testtools.matchers._impl.MismatchError: 0 != 1: ["Arguments dropped when creating context: {'is_admin_project': True}"]

  Steps to reproduce
  ==================
  Just run the context tests:
      tox -e py27 test_context

  This is because we missed to pass "is_admin_project" parameter to
  __init__() of  oslo.context.ResourceContext when initializing a nova
  ResourceContext object.

  In nova/context.py

  @enginefacade.transaction_context_provider
  class RequestContext(context.RequestContext):
      """Security context and request information.

      Represents the user taking a given action within the system.

      """

      def __init__(self, user_id=None, project_id=None,
                   is_admin=None, read_deleted="no",
                   roles=None, remote_address=None, timestamp=None,
                   request_id=None, auth_token=None, overwrite=True,
                   quota_class=None, user_name=None, project_name=None,
                   service_catalog=None, instance_lock_checked=False,
                   user_auth_plugin=None, **kwargs):
      ......
          super(RequestContext, self).__init__(
              ......
              is_admin=is_admin,
              ......)

  But in oslo_context/context.py,

  class RequestContext(object):

      ......

      def __init__(......
                   is_admin=False,
                   ......
                   is_admin_project=True):

To manage notifications about this bug go to:
https://bugs.launchpad.net/nova/+bug/1603979/+subscriptions


References