]> review.fuel-infra Code Review - openstack-build/neutron-build.git/commitdiff
Fix test case for DHCP agent interface restart
authorKevin Benton <blak111@gmail.com>
Fri, 27 Mar 2015 15:13:58 +0000 (08:13 -0700)
committerKevin Benton <blak111@gmail.com>
Fri, 27 Mar 2015 15:16:08 +0000 (08:16 -0700)
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

index b574f9312249b9efb67e2c75ded560b038ff2788..c618658f7c5659d6c98bf5aaef8ef0a77f51c5b8 100644 (file)
@@ -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)])