summaryrefslogtreecommitdiff
path: root/smoketest/scripts/cli
diff options
context:
space:
mode:
authorChristian Breunig <christian@breunig.cc>2023-03-27 08:47:21 +0200
committerGitHub <noreply@github.com>2023-03-27 08:47:21 +0200
commit0b34ab8fa73d22779e6120d1fea5edbbc5f9810f (patch)
treecbccc7d71e77bde44756c0ab34fa06662acf5bad /smoketest/scripts/cli
parent19ff8d43d2ad1adcea7d3d98756c58c836b7116f (diff)
parent3826517b1d1672d6ad5e2d1c2a8b7d70e22fd0ae (diff)
downloadvyos-1x-0b34ab8fa73d22779e6120d1fea5edbbc5f9810f.tar.gz
vyos-1x-0b34ab8fa73d22779e6120d1fea5edbbc5f9810f.zip
Merge pull request #1914 from indrajitr/pdns-port
dns: T5113: Support custom port for name-server forwarders
Diffstat (limited to 'smoketest/scripts/cli')
-rwxr-xr-xsmoketest/scripts/cli/test_service_dns_forwarding.py14
1 files changed, 10 insertions, 4 deletions
diff --git a/smoketest/scripts/cli/test_service_dns_forwarding.py b/smoketest/scripts/cli/test_service_dns_forwarding.py
index 94e0597ad..04dced292 100755
--- a/smoketest/scripts/cli/test_service_dns_forwarding.py
+++ b/smoketest/scripts/cli/test_service_dns_forwarding.py
@@ -20,6 +20,7 @@ import unittest
from base_vyostest_shim import VyOSUnitTestSHIM
from vyos.configsession import ConfigSessionError
+from vyos.template import bracketize_ipv6
from vyos.util import read_file
from vyos.util import process_named_running
@@ -141,15 +142,20 @@ class TestServicePowerDNS(VyOSUnitTestSHIM.TestCase):
for address in listen_adress:
self.cli_set(base_path + ['listen-address', address])
- nameservers = ['192.0.2.1', '192.0.2.2']
- for nameserver in nameservers:
- self.cli_set(base_path + ['name-server', nameserver])
+ nameservers = {'192.0.2.1': {}, '192.0.2.2': {'port': '53'}, '2001:db8::1': {'port': '853'}}
+ for h,p in nameservers.items():
+ if 'port' in p:
+ self.cli_set(base_path + ['name-server', h, 'port', p['port']])
+ else:
+ self.cli_set(base_path + ['name-server', h])
# commit changes
self.cli_commit()
tmp = get_config_value(r'\+.', 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))
# Do not use local /etc/hosts file in name resolution
# default: yes