]> review.fuel-infra Code Review - openstack-build/neutron-build.git/commitdiff
tests: don't allow oslo.config to autodiscover config files
authorIhar Hrachyshka <ihrachys@redhat.com>
Fri, 10 Apr 2015 09:29:56 +0000 (11:29 +0200)
committerIhar Hrachyshka <ihrachys@redhat.com>
Tue, 12 May 2015 11:44:14 +0000 (11:44 +0000)
oslo.config makes attempts to autodiscover configuration files using
find_config_files() helper. If e.g. /etc/neutron/neutron.conf exists,
and is not readable, the following test failure can be experienced:

oslo_config.cfg.ConfigFilesPermissionDeniedError: Failed to open some
config files: /etc/neutron/neutron.conf

Unit tests must not rely on any external state of the system and run
successfully no matter whether neutron is actually installed on the
system, or not.

Closes-Bug: #1442543
Change-Id: Ic90d8c40b2072fdda152703b84081719936b5f4e

neutron/tests/base.py

index 646a23f63c18da4a6e9b4a6086a555bf85882ea0..0e1c8a07959305222be552bc3932477b352ac315 100644 (file)
@@ -266,6 +266,10 @@ class BaseTestCase(DietTestCase):
             'neutron.common.exceptions.NeutronException.use_fatal_exceptions',
             fake_use_fatal_exceptions))
 
+        self.useFixture(fixtures.MonkeyPatch(
+            'oslo_config.cfg.find_config_files',
+            lambda project=None, prog=None, extension=None: []))
+
         self.setup_rpc_mocks()
         self.setup_config()
         self.setup_test_registry_instance()