"NoSuchOptError: no such option: config_dir" during neutron.tests.unit.vmware.extensions.test_maclearning.MacLearningDBTestCase

Bug #1400301 reported by Ihar Hrachyshka
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
neutron
Fix Released
Undecided
Ihar Hrachyshka

Bug Description

The cause of the failure is similar to bug 1392569 though the fix is different. The test case in question does not overwrite parse_config(), instead it calls super().setUp() too late so policy code is already triggered and hence failed.

Revision history for this message
Ihar Hrachyshka (ihar-hrachyshka) wrote :
Revision history for this message
Ihar Hrachyshka (ihar-hrachyshka) wrote :

ft1.11034: neutron.tests.unit.vmware.extensions.test_maclearning.MacLearningDBTestCase.test_list_ports_StringException: Traceback (most recent call last):
  File "neutron/tests/unit/vmware/extensions/test_maclearning.py", line 54, in setUp
    self.adminContext = context.get_admin_context()
  File "neutron/context.py", line 170, in get_admin_context
    overwrite=False)
  File "neutron/context.py", line 68, in __init__
    self.is_advsvc = policy.check_is_advsvc(self)
  File "neutron/policy.py", line 441, in check_is_advsvc
    init()
  File "neutron/policy.py", line 79, in init
    _ENFORCER.load_rules(True)
  File "neutron/openstack/common/policy.py", line 246, in load_rules
    path = self._get_policy_path(path)
  File "neutron/openstack/common/policy.py", line 282, in _get_policy_path
    policy_path = CONF.find_file(path)
  File "/home/jenkins/workspace/gate-neutron-python27/.tox/py27/local/lib/python2.7/site-packages/oslo/config/cfg.py", line 2006, in find_file
    if self.config_dir:
  File "/home/jenkins/workspace/gate-neutron-python27/.tox/py27/local/lib/python2.7/site-packages/oslo/config/cfg.py", line 1745, in __getattr__
    raise NoSuchOptError(name)
NoSuchOptError: no such option: config_dir

Changed in neutron:
assignee: nobody → Ihar Hrachyshka (ihar-hrachyshka)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to neutron (master)

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

Changed in neutron:
status: New → In Progress
description: updated
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to neutron-vpnaas (master)

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

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

Reviewed: https://review.openstack.org/141405
Committed: https://git.openstack.org/cgit/openstack/neutron-vpnaas/commit/?id=5253ceb9a5e0643c98ac66e9d3fd6368ca035f6c
Submitter: Jenkins
Branch: master

commit 5253ceb9a5e0643c98ac66e9d3fd6368ca035f6c
Author: Ihar Hrachyshka <email address hidden>
Date: Fri Dec 12 16:30:18 2014 +0100

    tests: initialize admin context after super().setUp call

    New policy code requires that CONF is already initialized when policy
    checks are invoked. It means that no Neutron context objects should be
    created before BaseTestCase.setUp() is called that will set
    configuration, among other things.

    Ideally, we would just make sure that all test cases invoke
    super().setUp() as the very first line of any subclass setUp() methods.
    But since some of test cases require prior setup (like mocking extension
    manager) before proceeding to base class, we end up with magically
    shuffling context instantiations to occur below super() calls.

    Change-Id: Ib1039ea1ff9480ca57f9cb0c917469d0d2ad28b8
    Closes-Bug: #1400301

Changed in neutron:
status: In Progress → Fix Committed
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to neutron (master)

Reviewed: https://review.openstack.org/139998
Committed: https://git.openstack.org/cgit/openstack/neutron/commit/?id=e33349e216e9361f4d93e012b91dd69b4bea9e92
Submitter: Jenkins
Branch: master

commit e33349e216e9361f4d93e012b91dd69b4bea9e92
Author: Ihar Hrachyshka <email address hidden>
Date: Mon Dec 8 13:51:02 2014 +0100

    tests: initialize admin context after super().setUp call

    New policy code requires that CONF is already initialized when policy
    checks are invoked. It means that no Neutron context objects should be
    created before BaseTestCase.setUp() is called that will set
    configuration, among other things.

    Ideally, we would just make sure that all test cases invoke
    super().setUp() as the very first line of any subclass setUp() methods.
    But since some of test cases require prior setup (like mocking extension
    manager) before proceeding to base class, we end up with magically
    shuffling context instantiations to occur below super() calls.

    Change-Id: Ib1039ea1ff9480ca57f9cb0c917469d0d2ad28b8
    Closes-Bug: #1400301

Thierry Carrez (ttx)
Changed in neutron:
milestone: none → kilo-1
status: Fix Committed → Fix Released
Thierry Carrez (ttx)
Changed in neutron:
milestone: kilo-1 → 2015.1.0
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.