← 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)

 

Nova didn't accept the  g-r update now, Maybe the CI test skip
oslo.context 2.6.0.

We have another fix in https://review.openstack.org/#/c/343694/

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

-- 
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):
  In Progress

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