Merge "DHCP: enhance DHCPAgent startup procedure" into stable/mitaka
This commit is contained in:
commit
774cb42f42
|
@ -94,7 +94,6 @@ class DhcpAgent(manager.Manager):
|
|||
|
||||
def run(self):
|
||||
"""Activate the DHCP agent."""
|
||||
self.sync_state()
|
||||
self.periodic_resync()
|
||||
|
||||
def call_driver(self, action, network, **action_kwargs):
|
||||
|
|
|
@ -245,9 +245,6 @@ class TestDhcpAgent(base.BaseTestCase):
|
|||
state_rpc_str = 'neutron.agent.rpc.PluginReportStateAPI'
|
||||
# sync_state is needed for this test
|
||||
cfg.CONF.set_override('report_interval', 1, 'AGENT')
|
||||
with mock.patch.object(dhcp_agent.DhcpAgentWithStateReport,
|
||||
'sync_state',
|
||||
autospec=True) as mock_sync_state:
|
||||
with mock.patch.object(dhcp_agent.DhcpAgentWithStateReport,
|
||||
'periodic_resync',
|
||||
autospec=True) as mock_periodic_resync:
|
||||
|
@ -265,7 +262,6 @@ class TestDhcpAgent(base.BaseTestCase):
|
|||
'testhost')
|
||||
eventlet.greenthread.sleep(1)
|
||||
agent_mgr.after_start()
|
||||
mock_sync_state.assert_called_once_with(agent_mgr)
|
||||
mock_periodic_resync.assert_called_once_with(agent_mgr)
|
||||
state_rpc.assert_has_calls(
|
||||
[mock.call(mock.ANY),
|
||||
|
@ -275,13 +271,10 @@ class TestDhcpAgent(base.BaseTestCase):
|
|||
def test_run_completes_single_pass(self):
|
||||
with mock.patch(DEVICE_MANAGER):
|
||||
dhcp = dhcp_agent.DhcpAgent(HOSTNAME)
|
||||
attrs_to_mock = dict(
|
||||
[(a, mock.DEFAULT) for a in
|
||||
['sync_state', 'periodic_resync']])
|
||||
with mock.patch.multiple(dhcp, **attrs_to_mock) as mocks:
|
||||
with mock.patch.object(dhcp,
|
||||
'periodic_resync') as periodic_resync_mock:
|
||||
dhcp.run()
|
||||
mocks['sync_state'].assert_called_once_with()
|
||||
mocks['periodic_resync'].assert_called_once_with()
|
||||
periodic_resync_mock.assert_called_once_with()
|
||||
|
||||
def test_call_driver(self):
|
||||
network = mock.Mock()
|
||||
|
|
Loading…
Reference in New Issue