Merge "Call config_parse in base test setup"

This commit is contained in:
Jenkins 2014-07-30 08:21:18 +00:00 committed by Gerrit Code Review
commit f25d8312fd
7 changed files with 23 additions and 1 deletions

View File

@ -190,6 +190,12 @@ class BaseTestCase(testtools.TestCase):
if sys.version_info < (2, 7) and getattr(self, 'fmt', '') == 'xml':
raise self.skipException('XML Testing Skipped in Py26')
self.setup_config()
def setup_config(self):
"""Tests that need a non-default config can override this method."""
self.config_parse()
def config(self, **kw):
"""Override some configuration values.

View File

@ -56,10 +56,12 @@ class OFAAgentTestCase(base.BaseTestCase):
super(OFAAgentTestCase, self).setUp()
self.fake_oflib_of = fake_oflib.patch_fake_oflib_of().start()
self.mod_agent = importutils.import_module(self._AGENT_NAME)
self.ryuapp = mock.Mock()
def setup_config(self):
cfg.CONF.set_default('firewall_driver',
'neutron.agent.firewall.NoopFirewallDriver',
group='SECURITYGROUP')
self.ryuapp = mock.Mock()
cfg.CONF.register_cli_opts([
cfg.StrOpt('ofp-listen-host', default='',
help='openflow listen host'),

View File

@ -22,6 +22,10 @@ from neutron.tests import base
class TestNetnsCleanup(base.BaseTestCase):
def setup_config(self):
# don't use default config
pass
def test_setup_conf(self):
expected_opts = interface.OPTS
conf = util.setup_conf()

View File

@ -26,6 +26,10 @@ from neutron.tests import base
class TestOVSCleanup(base.BaseTestCase):
def setup_config(self):
# don't use default config
pass
def test_setup_conf(self):
conf = util.setup_conf()
self.assertEqual(conf.external_network_bridge, 'br-ex')

View File

@ -24,6 +24,10 @@ from neutron.tests import base
class ConfigurationTest(base.BaseTestCase):
def setup_config(self):
# don't use default config
pass
def test_defaults(self):
self.assertEqual('0.0.0.0', cfg.CONF.bind_host)
self.assertEqual(9696, cfg.CONF.bind_port)

View File

@ -645,6 +645,7 @@ class TestDhcpAgentEventHandler(base.BaseTestCase):
def test_enable_isolated_metadata_proxy_with_metadata_network(self):
cfg.CONF.set_override('enable_metadata_network', True)
cfg.CONF.set_override('debug', True)
cfg.CONF.set_override('verbose', False)
cfg.CONF.set_override('log_file', 'test.log')
class_path = 'neutron.agent.linux.ip_lib.IPWrapper'
self.external_process_p.stop()

View File

@ -1843,6 +1843,7 @@ class TestL3AgentEventHandler(base.BaseTestCase):
'interface_driver', 'neutron.agent.linux.interface.NullDriver'
)
cfg.CONF.set_override('use_namespaces', True)
cfg.CONF.set_override('verbose', False)
agent_config.register_root_helper(cfg.CONF)
device_exists_p = mock.patch(