From 774242fb6389466f8bc57f289471010a57bb64ea Mon Sep 17 00:00:00 2001 From: Wen Liang Date: Mon, 27 Sep 2021 07:41:00 -0400 Subject: [PATCH] test IPv6 DNS when static IPv6 is configured When static IPv6 is configured, configuring IPv6 DNS will not raise any validation error. Add unit test to verify that. Signed-off-by: Wen Liang --- tests/unit/test_network_connections.py | 30 ++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/tests/unit/test_network_connections.py b/tests/unit/test_network_connections.py index 7af48f5..3b36d0c 100644 --- a/tests/unit/test_network_connections.py +++ b/tests/unit/test_network_connections.py @@ -3664,6 +3664,36 @@ class TestValidator(Python26CompatTestCase): 0, ) + def test_ipv6_dns_with_static_ipv6_configuration(self): + """ + Test that configuring IPv6 DNS is allowed when static IPv6 is configured. + """ + validator = network_lsr.argument_validator.ArgValidator_ListConnections() + ipv6_dns_with_static_ipv6_configuration = [ + { + "name": "test_ipv6_dns", + "type": "ethernet", + "ip": { + "dhcp4": False, + "auto6": False, + "dns": ["2001:db8::20"], + "address": ["2001:db8::2/32"], + }, + } + ] + # the connection index is 0 because there is only one connection profile + # defined here + connection_index = 0 + + self.assertEqual( + validator.validate_connection_one( + "nm", + validator.validate(ipv6_dns_with_static_ipv6_configuration), + connection_index, + ), + None, + ) + def test_ipv6_dns_options_without_ipv6_config(self): """ Test that configuring IPv6 DNS options is not allowed when IPv6 is disabled.