]> review.fuel-infra Code Review - openstack-build/neutron-build.git/commitdiff
Make pep8 job succeed when /etc/neutron/neutron.conf is not installed
authorIhar Hrachyshka <ihrachys@redhat.com>
Tue, 9 Jun 2015 10:46:54 +0000 (12:46 +0200)
committerIhar Hrachyshka <ihrachys@redhat.com>
Tue, 9 Jun 2015 10:50:35 +0000 (12:50 +0200)
Currently, if /etc/neutron/neutron.conf is not installed in the system,
neutron-db-manage fails in oslo.config code when trying to determine the
default configuration file to use.

Test job should not rely on any contents inside /etc/.

Instead, pass --config-file with test-only configuration explicitly into
the utility.

neutron.conf.test was renamed into neutron.conf since for some reason
oslo.config does not support a name that does not have .conf at its
filename end.

Change-Id: I719829fc83a7b20a49c338aaf1dbef916dcc768c

neutron/tests/base.py
neutron/tests/etc/neutron.conf [moved from neutron/tests/etc/neutron.conf.test with 100% similarity]
neutron/tests/unit/agent/dhcp/test_agent.py
neutron/tests/unit/api/test_extensions.py
neutron/tests/unit/db/test_db_base_plugin_v2.py
tox.ini

index 7b18901044be19827c4ce5bf1981b5d1fe13c6bf..f55dbeab3b15679efea31be7b81b83d63d34c024 100644 (file)
@@ -238,10 +238,10 @@ class BaseTestCase(DietTestCase):
     @staticmethod
     def config_parse(conf=None, args=None):
         """Create the default configurations."""
-        # neutron.conf.test includes rpc_backend which needs to be cleaned up
+        # neutron.conf includes rpc_backend which needs to be cleaned up
         if args is None:
             args = []
-        args += ['--config-file', etcdir('neutron.conf.test')]
+        args += ['--config-file', etcdir('neutron.conf')]
         if conf is None:
             config.init(args=args)
         else:
index 64da28398f11a71f21267405f6b92058e635f5f5..a068ea0163439fc5ef1bd8bacf48c08e3f7fcd78 100644 (file)
@@ -236,7 +236,7 @@ class TestDhcpAgent(base.BaseTestCase):
                     with mock.patch.object(sys, 'argv') as sys_argv:
                         sys_argv.return_value = [
                             'dhcp', '--config-file',
-                            base.etcdir('neutron.conf.test')]
+                            base.etcdir('neutron.conf')]
                         cfg.CONF.register_opts(dhcp_config.DHCP_AGENT_OPTS)
                         config.register_interface_driver_opts_helper(cfg.CONF)
                         config.register_agent_state_opts_helper(cfg.CONF)
@@ -260,7 +260,7 @@ class TestDhcpAgent(base.BaseTestCase):
             with mock.patch.object(sys, 'argv') as sys_argv:
                 with mock.patch(launcher_str) as launcher:
                     sys_argv.return_value = ['dhcp', '--config-file',
-                                             base.etcdir('neutron.conf.test')]
+                                             base.etcdir('neutron.conf')]
                     entry.main()
                     launcher.assert_has_calls(
                         [mock.call(), mock.call().launch_service(mock.ANY),
index aabece09d4c8ee48ed4c90d921965cdb6f6c2fb0..9a32e865f941d8ccb20db6cbfeab404e683f3d92 100644 (file)
@@ -726,7 +726,7 @@ class ExtensionExtendedAttributeTestCase(base.BaseTestCase):
             "ExtensionExtendedAttributeTestPlugin"
         )
 
-        # point config file to: neutron/tests/etc/neutron.conf.test
+        # point config file to: neutron/tests/etc/neutron.conf
         self.config_parse()
 
         self.setup_coreplugin(plugin)
index b215ab3de39ee9160b834d3dff341b92e9fc9603..215cca0de1d0142837bfcdcbc1845e24ad8b43d3 100644 (file)
@@ -164,7 +164,7 @@ class NeutronDbPluginV2TestCase(testlib_api.WebTestCase):
 
     def setup_config(self):
         # Create the default configurations
-        args = ['--config-file', base.etcdir('neutron.conf.test')]
+        args = ['--config-file', base.etcdir('neutron.conf')]
         # If test_config specifies some config-file, use it, as well
         for config_file in test_lib.test_config.get('config_files', []):
             args.extend(['--config-file', config_file])
diff --git a/tox.ini b/tox.ini
index 636a2a3773900a1db21c8e69ae54417ebb72fca8..a33e89a23b2af568a12320262e3790854be34edd 100644 (file)
--- a/tox.ini
+++ b/tox.ini
@@ -72,7 +72,7 @@ commands=
   # Checks for coding and style guidelines
   flake8
   sh ./tools/coding-checks.sh --pylint '{posargs}'
-  neutron-db-manage check_migration
+  neutron-db-manage --config-file neutron/tests/etc/neutron.conf check_migration
 whitelist_externals =
   sh
   bash