Allow tests from test_dhcp_agent run independently

Some tests from test_dhcp_agent depend on each other
and cannot be run in arbitrary order. TestDhcpAgent
and TestDhcpAgentEventHandler need config options that
are initialized in other tests. This patch eliminates
such dependencies.

Fixes: bug #1125951
Change-Id: I10bc46a5e1244ea0f7a05a20bb162c50303f282e
This commit is contained in:
Alessio Ababilov 2013-02-15 09:52:24 +02:00
parent 13f4ed7524
commit 2f649454ef

View File

@ -86,6 +86,7 @@ fake_down_network = FakeModel('12345678-dddd-dddd-1234567890ab',
class TestDhcpAgent(unittest.TestCase):
def setUp(self):
cfg.CONF.register_opts(dhcp_agent.DeviceManager.OPTS)
cfg.CONF.register_opts(dhcp_agent.DhcpAgent.OPTS)
cfg.CONF.register_opts(dhcp_agent.DhcpLeaseRelay.OPTS)
self.driver_cls_p = mock.patch(
@ -267,6 +268,7 @@ class TestDhcpAgent(unittest.TestCase):
class TestDhcpAgentEventHandler(unittest.TestCase):
def setUp(self):
cfg.CONF.register_opts(dhcp_agent.DeviceManager.OPTS)
cfg.CONF.register_opts(dhcp_agent.DhcpLeaseRelay.OPTS)
cfg.CONF.set_override('interface_driver',
'quantum.agent.linux.interface.NullDriver')
config.register_root_helper(cfg.CONF)