From 803f7b85448bbe7fbff8e245913eb3031f5abdc6 Mon Sep 17 00:00:00 2001 From: Kevin Benton Date: Thu, 15 Jun 2017 00:22:19 -0700 Subject: [PATCH] Fix test_dvr_gateway_host_binding_is_set Router scheduling was happening before the schedule call so sometimes the router was being scheduled to a different host than the test was expecting. This fixes it by explicitly setting the router to not be HA and calls schedule before adding interfaces that would trigger scheduling. Closes-Bug: #1698058 Change-Id: I6c6319f1da72546a9d21af198daf9a2a67e6dec8 --- .../services/l3_router/test_l3_dvr_router_plugin.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/neutron/tests/functional/services/l3_router/test_l3_dvr_router_plugin.py b/neutron/tests/functional/services/l3_router/test_l3_dvr_router_plugin.py index ea00b8e1247..1af1e1d46c4 100644 --- a/neutron/tests/functional/services/l3_router/test_l3_dvr_router_plugin.py +++ b/neutron/tests/functional/services/l3_router/test_l3_dvr_router_plugin.py @@ -717,7 +717,7 @@ class L3DvrTestCase(L3DvrTestCaseBase): expected_calls) def test_dvr_gateway_host_binding_is_set(self): - router = self._create_router() + router = self._create_router(ha=False) private_net1 = self._make_network(self.fmt, 'net1', True) kwargs = {'arg_list': (external_net.EXTERNAL,), external_net.EXTERNAL: True} @@ -725,6 +725,9 @@ class L3DvrTestCase(L3DvrTestCaseBase): self._make_subnet( self.fmt, ext_net, '10.20.0.1', '10.20.0.0/24', ip_version=4, enable_dhcp=True) + self.l3_plugin.schedule_router(self.context, + router['id'], + candidates=[self.l3_agent]) # Set gateway to router self.l3_plugin._update_router_gw_info( self.context, router['id'], @@ -739,9 +742,6 @@ class L3DvrTestCase(L3DvrTestCaseBase): self.l3_plugin.add_router_interface( self.context, router['id'], {'subnet_id': private_subnet1['subnet']['id']}) - self.l3_plugin.schedule_router(self.context, - router['id'], - candidates=[self.l3_agent]) # Check for the gw_port_host in the router dict to make # sure that the _build_routers_list in l3_dvr_db is called. router_handle = (