diff options
author | Christian Breunig <christian@breunig.cc> | 2023-03-29 10:33:30 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-03-29 10:33:30 +0200 |
commit | c675fbf336365f70a7f783590daf70efca0f4941 (patch) | |
tree | 71acf469350c926780b1377d0dcc21568a290abd /smoketest | |
parent | 454a49dfc1e2c08f72e9f9ae9a4a90818be76ae3 (diff) | |
parent | 2bb5c5d0fd9ed07649b81a61e9c1a78a9f222405 (diff) | |
download | vyos-1x-c675fbf336365f70a7f783590daf70efca0f4941.tar.gz vyos-1x-c675fbf336365f70a7f783590daf70efca0f4941.zip |
Merge pull request #1915 from indrajitr/pdns-port-round2
dns: T5115: Support custom port for name servers for forwarding zones
Diffstat (limited to 'smoketest')
-rwxr-xr-x | smoketest/scripts/cli/test_service_dns_forwarding.py | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/smoketest/scripts/cli/test_service_dns_forwarding.py b/smoketest/scripts/cli/test_service_dns_forwarding.py index 04dced292..88492e348 100755 --- a/smoketest/scripts/cli/test_service_dns_forwarding.py +++ b/smoketest/scripts/cli/test_service_dns_forwarding.py @@ -169,10 +169,13 @@ class TestServicePowerDNS(VyOSUnitTestSHIM.TestCase): self.cli_set(base_path + ['listen-address', address]) domains = ['vyos.io', 'vyos.net', 'vyos.com'] - nameservers = ['192.0.2.1', '192.0.2.2'] + nameservers = {'192.0.2.1': {}, '192.0.2.2': {'port': '53'}, '2001:db8::1': {'port': '853'}} for domain in domains: - for nameserver in nameservers: - self.cli_set(base_path + ['domain', domain, 'server', nameserver]) + for h,p in nameservers.items(): + if 'port' in p: + self.cli_set(base_path + ['domain', domain, 'name-server', h, 'port', p['port']]) + else: + self.cli_set(base_path + ['domain', domain, 'name-server', h]) # Test 'recursion-desired' flag for only one domain if domain == domains[0]: @@ -192,7 +195,9 @@ class TestServicePowerDNS(VyOSUnitTestSHIM.TestCase): if domain == domains[0]: key =f'\+{domain}' else: key =f'{domain}' tmp = get_config_value(key, file=FORWARD_FILE) - self.assertEqual(tmp, ', '.join(nameservers)) + canonical_entries = [(lambda h, p: f"{bracketize_ipv6(h)}:{p['port'] if 'port' in p else 53}")(h, p) + for (h, p) in nameservers.items()] + self.assertEqual(tmp, ', '.join(canonical_entries)) # Test 'negative trust anchor' flag for the second domain only if domain == domains[1]: |