From 18c5a8b2e9161e8beda8a14078a1e8d666e900d1 Mon Sep 17 00:00:00 2001 From: Kevin Benton Date: Fri, 27 Mar 2015 08:13:58 -0700 Subject: [PATCH] Fix test case for DHCP agent interface restart One of the new test cases in the recent DHCP interface patch[1] was supposed to confirm that the driver wouldn't be restarted if the IP address stayed the same. However, it wasn't matching the device ID of the agent so it was never making it to that conditional. This patch just fixes that UT so it's exercising the right code path. 1. c4a7447e2d659b3a240a62ae9d34e6e0b9cee7a3 Change-Id: I8735c6e533d6b486c32cfded2c22eac8a25c855d --- neutron/tests/unit/test_dhcp_agent.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/neutron/tests/unit/test_dhcp_agent.py b/neutron/tests/unit/test_dhcp_agent.py index b574f931224..c618658f7c5 100644 --- a/neutron/tests/unit/test_dhcp_agent.py +++ b/neutron/tests/unit/test_dhcp_agent.py @@ -930,9 +930,12 @@ class TestDhcpAgentEventHandler(base.BaseTestCase): [mock.call.call_driver('restart', fake_network)]) def test_port_update_on_dhcp_agents_port_no_ip_change(self): - payload = dict(port=fake_port1) self.cache.get_network_by_id.return_value = fake_network self.cache.get_port_by_id.return_value = fake_port1 + payload = dict(port=fake_port1) + device_id = utils.get_dhcp_agent_device_id( + payload['port']['network_id'], self.dhcp.conf.host) + payload['port']['device_id'] = device_id self.dhcp.port_update_end(None, payload) self.call_driver.assert_has_calls( [mock.call.call_driver('reload_allocations', fake_network)])