Public bug reported: Some tests mock os.path.exists. By doing so, they break config file search code located in oslo.config.find_file. This results in the following failures when running those tests separately. Note that tests pass in case test runner initialized policy before in another test case.
====================================================================== ERROR: neutron.tests.unit.test_metadata_agent.TestUnixDomainMetadataProxy.test_init_exists_unlink_no_file ---------------------------------------------------------------------- Empty attachments: pythonlogging:'' pythonlogging:'neutron.api.extensions' Traceback (most recent call last): File "neutron/tests/unit/test_metadata_agent.py", line 595, in test_init_exists_unlink_no_file agent.UnixDomainMetadataProxy(mock.Mock()) File "neutron/agent/metadata/agent.py", line 323, in __init__ self._init_state_reporting() File "neutron/agent/metadata/agent.py", line 326, in _init_state_reporting self.context = context.get_admin_context_without_session() File "neutron/context.py", line 176, in get_admin_context_without_session read_deleted=read_deleted) File "neutron/context.py", line 68, in __init__ self.is_advsvc = policy.check_is_advsvc(self) File "neutron/policy.py", line 440, in check_is_advsvc init() File "neutron/policy.py", line 79, in init _ENFORCER.load_rules(True) File "neutron/openstack/common/policy.py", line 241, in load_rules self.policy_path = self._get_policy_path(self.policy_file) File "neutron/openstack/common/policy.py", line 287, in _get_policy_path raise cfg.ConfigFilesNotFoundError((path,)) ConfigFilesNotFoundError: Failed to find some config files: policy.json Solution is to initialize policy at the start of any unit test. ** Affects: neutron Importance: Undecided Assignee: Ihar Hrachyshka (ihar-hrachyshka) Status: New ** Changed in: neutron Assignee: (unassigned) => Ihar Hrachyshka (ihar-hrachyshka) -- You received this bug notification because you are a member of Yahoo! Engineering Team, which is subscribed to neutron. https://bugs.launchpad.net/bugs/1426369 Title: tests that mock os.path.exists should initialize policy first Status in OpenStack Neutron (virtual network service): New Bug description: Some tests mock os.path.exists. By doing so, they break config file search code located in oslo.config.find_file. This results in the following failures when running those tests separately. Note that tests pass in case test runner initialized policy before in another test case. ====================================================================== ERROR: neutron.tests.unit.test_metadata_agent.TestUnixDomainMetadataProxy.test_init_exists_unlink_no_file ---------------------------------------------------------------------- Empty attachments: pythonlogging:'' pythonlogging:'neutron.api.extensions' Traceback (most recent call last): File "neutron/tests/unit/test_metadata_agent.py", line 595, in test_init_exists_unlink_no_file agent.UnixDomainMetadataProxy(mock.Mock()) File "neutron/agent/metadata/agent.py", line 323, in __init__ self._init_state_reporting() File "neutron/agent/metadata/agent.py", line 326, in _init_state_reporting self.context = context.get_admin_context_without_session() File "neutron/context.py", line 176, in get_admin_context_without_session read_deleted=read_deleted) File "neutron/context.py", line 68, in __init__ self.is_advsvc = policy.check_is_advsvc(self) File "neutron/policy.py", line 440, in check_is_advsvc init() File "neutron/policy.py", line 79, in init _ENFORCER.load_rules(True) File "neutron/openstack/common/policy.py", line 241, in load_rules self.policy_path = self._get_policy_path(self.policy_file) File "neutron/openstack/common/policy.py", line 287, in _get_policy_path raise cfg.ConfigFilesNotFoundError((path,)) ConfigFilesNotFoundError: Failed to find some config files: policy.json Solution is to initialize policy at the start of any unit test. To manage notifications about this bug go to: https://bugs.launchpad.net/neutron/+bug/1426369/+subscriptions -- Mailing list: https://launchpad.net/~yahoo-eng-team Post to : yahoo-eng-team@lists.launchpad.net Unsubscribe : https://launchpad.net/~yahoo-eng-team More help : https://help.launchpad.net/ListHelp