Fix TestOVNMechanismDriver ipv6 tests
- test_update_subnet_dhcp_options_in_ovn_ipv6_not_change - test_enable_subnet_dhcp_options_in_ovn_ipv6 This tests will fail if host where unit tests has ipv6 dns_servers configured. This patch mocks get_system_dns_servers to avoid tests to look at the host configuration. Closes-Bug: #2056778 Change-Id: I2e703ab4b63c90d7a14f0dc41d37b0a98163bce0
This commit is contained in:
parent
e8468a6dd6
commit
2a196fefd4
@ -1616,9 +1616,10 @@ class TestOVNMechanismDriver(TestOVNMechanismDriverBase):
|
|||||||
self.mech_driver.nb_ovn.set_lswitch_port.assert_has_calls(
|
self.mech_driver.nb_ovn.set_lswitch_port.assert_has_calls(
|
||||||
set_lsp_calls, any_order=True)
|
set_lsp_calls, any_order=True)
|
||||||
|
|
||||||
|
@mock.patch.object(ovn_utils, 'get_system_dns_resolvers')
|
||||||
@mock.patch.object(db_base_plugin_v2.NeutronDbPluginV2, 'get_ports')
|
@mock.patch.object(db_base_plugin_v2.NeutronDbPluginV2, 'get_ports')
|
||||||
@mock.patch.object(n_net, 'get_random_mac')
|
@mock.patch.object(n_net, 'get_random_mac')
|
||||||
def test_enable_subnet_dhcp_options_in_ovn_ipv6(self, grm, gps):
|
def test_enable_subnet_dhcp_options_in_ovn_ipv6(self, grm, gps, gsd):
|
||||||
grm.return_value = '01:02:03:04:05:06'
|
grm.return_value = '01:02:03:04:05:06'
|
||||||
gps.return_value = [
|
gps.return_value = [
|
||||||
{'id': 'port-id-1', 'device_owner': 'nova:compute'},
|
{'id': 'port-id-1', 'device_owner': 'nova:compute'},
|
||||||
@ -1631,6 +1632,7 @@ class TestOVNMechanismDriver(TestOVNMechanismDriverBase):
|
|||||||
{'opt_value': '10::34', 'ip_version': 6,
|
{'opt_value': '10::34', 'ip_version': 6,
|
||||||
'opt_name': 'dns-server'}]},
|
'opt_name': 'dns-server'}]},
|
||||||
{'id': 'port-id-10', 'device_owner': 'network:foo'}]
|
{'id': 'port-id-10', 'device_owner': 'network:foo'}]
|
||||||
|
gsd.return_value = []
|
||||||
subnet = {'id': 'subnet-id', 'ip_version': 6, 'cidr': '10::0/64',
|
subnet = {'id': 'subnet-id', 'ip_version': 6, 'cidr': '10::0/64',
|
||||||
'gateway_ip': '10::1', 'enable_dhcp': True,
|
'gateway_ip': '10::1', 'enable_dhcp': True,
|
||||||
'ipv6_address_mode': 'dhcpv6-stateless',
|
'ipv6_address_mode': 'dhcpv6-stateless',
|
||||||
@ -1797,7 +1799,9 @@ class TestOVNMechanismDriver(TestOVNMechanismDriverBase):
|
|||||||
self.mech_driver.nb_ovn.add_dhcp_options.assert_called_once_with(
|
self.mech_driver.nb_ovn.add_dhcp_options.assert_called_once_with(
|
||||||
subnet['id'], **new_options)
|
subnet['id'], **new_options)
|
||||||
|
|
||||||
def test_update_subnet_dhcp_options_in_ovn_ipv6_not_change(self):
|
@mock.patch.object(ovn_utils, 'get_system_dns_resolvers')
|
||||||
|
def test_update_subnet_dhcp_options_in_ovn_ipv6_not_change(self, gsd):
|
||||||
|
gsd.return_value = []
|
||||||
subnet = {'id': 'subnet-id', 'ip_version': 6, 'cidr': '10::0/64',
|
subnet = {'id': 'subnet-id', 'ip_version': 6, 'cidr': '10::0/64',
|
||||||
'gateway_ip': '10::1', 'enable_dhcp': True,
|
'gateway_ip': '10::1', 'enable_dhcp': True,
|
||||||
'ipv6_address_mode': 'dhcpv6-stateless',
|
'ipv6_address_mode': 'dhcpv6-stateless',
|
||||||
|
Loading…
Reference in New Issue
Block a user