From 5a9036f49e7eb3f64e42bd7dabb7b571a2111556 Mon Sep 17 00:00:00 2001 From: Slawek Kaplonski Date: Wed, 10 Apr 2019 18:44:26 +0200 Subject: [PATCH] Mock check if ipv6 is enabled in L3 agent unit tests Without this mock UT related configure_ipv6 method were failing e.g. on systems when IPv6 was disabled or on systems where such check should be done differently, like MacOS. Change-Id: I6d13ab1db1d5465b2ff6abf6499e0d17e1ee8bbb (cherry picked from commit c20b5e347dcc47bfe2f649cdd4310c1fac68b447) --- neutron/tests/unit/agent/l3/test_agent.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/neutron/tests/unit/agent/l3/test_agent.py b/neutron/tests/unit/agent/l3/test_agent.py index 11bb32f56da..afea507aa74 100644 --- a/neutron/tests/unit/agent/l3/test_agent.py +++ b/neutron/tests/unit/agent/l3/test_agent.py @@ -289,7 +289,11 @@ class TestBasicRouterOperations(BasicRouterOperationsFramework): destroy_metadata_proxy.assert_not_called() def _test__configure_ipv6_params_helper(self, state, gw_port_id): - agent = l3_agent.L3NATAgent(HOSTNAME, self.conf) + with mock.patch( + 'neutron.common.ipv6_utils.is_enabled_and_bind_by_default', + return_value=True): + agent = l3_agent.L3NATAgent(HOSTNAME, self.conf) + router_info = l3router.RouterInfo(agent, _uuid(), {}, **self.ri_kwargs) if gw_port_id: router_info.ex_gw_port = {'id': gw_port_id}