]> review.fuel-infra Code Review - openstack-build/neutron-build.git/commitdiff
ofa_test_base: Fix NoSuchOptError in UT
authorYAMAMOTO Takashi <yamamoto@valinux.co.jp>
Fri, 14 Nov 2014 03:39:37 +0000 (12:39 +0900)
committerYAMAMOTO Takashi <yamamoto@valinux.co.jp>
Wed, 10 Dec 2014 04:23:37 +0000 (13:23 +0900)
Ensure setting up cfg.CONF.
Otherwise, depending on the execution order of tests,
some tests in test_ofa_neutron_agent can fail with
the following exception:

    NoSuchOptError: no such option: config_dir

The problem has been exposed by the recently merged change
for policy module, commit d83731a96d3b47fab1295de1fb53cfe30576619c .

Closes-Bug: #1392569
Change-Id: I0d38df0510b95160c67ea7b76ed413138fa3d770

neutron/tests/base.py
neutron/tests/unit/ofagent/ofa_test_base.py
neutron/tests/unit/test_db_plugin.py

index 56678fe7b59c91d4713b438588001d887571f5c8..a39397c2818dc9a97157c3bbcddffe3b460d97e2 100644 (file)
@@ -118,9 +118,9 @@ class BaseTestCase(sub_base.SubBaseTestCase):
         self.addCleanup(n_rpc.cleanup)
         n_rpc.init(CONF)
 
-    def setup_config(self):
+    def setup_config(self, args=None):
         """Tests that need a non-default config can override this method."""
-        self.config_parse()
+        self.config_parse(args=args)
 
     def config(self, **kw):
         """Override some configuration values.
index 60c03ce7627a5a8144bbec022f160700b4403011..0ff9c43356deae5fcd742efdc3880470dfeaccfe 100644 (file)
@@ -69,3 +69,4 @@ class OFAAgentTestBase(OFATestBase):
                        help='openflow tcp listen port')
         ])
         cfg.CONF.set_override('root_helper', 'fake_helper', group='AGENT')
+        super(OFATestBase, self).setup_config()
index f1f54c3a146fda8733b9bffb42fc7294910a0732..f5b2f90f1386f5a7b5f983245ac6de2eb7154d03 100644 (file)
@@ -155,7 +155,7 @@ class NeutronDbPluginV2TestCase(testlib_api.WebTestCase,
         # 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])
-        self.config_parse(args=args)
+        super(NeutronDbPluginV2TestCase, self).setup_config(args=args)
 
     def _req(self, method, resource, data=None, fmt=None, id=None, params=None,
              action=None, subresource=None, sub_id=None, context=None):