From: Remi Gacogne Date: Thu, 16 Jul 2026 12:51:55 +0000 (+0200) Subject: dnsdist: Add a regression test for PDNSException raised from C++ while parsing a... X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=dc17848588a6009aa5ba528e8e7ebc2ffb064cfe;p=thirdparty%2Fpdns.git dnsdist: Add a regression test for PDNSException raised from C++ while parsing a YAML configuration file Signed-off-by: Remi Gacogne --- diff --git a/regression-tests.dnsdist/test_Yaml.py b/regression-tests.dnsdist/test_Yaml.py index fa0ca08424..69b8553844 100644 --- a/regression-tests.dnsdist/test_Yaml.py +++ b/regression-tests.dnsdist/test_Yaml.py @@ -657,6 +657,59 @@ pools: cls.killProcess(cls._dnsdist) +class TestYamlInvalidComboAddress(DNSDistTest): + _yaml_config_template = """--- +logging: + structured: + enabled: false + +binds: + - listen_address: "127.0.0.1:%d" + protocol: Do53 + +backends: + - address: "127.0.0.1:%d" + protocol: Do53 + +query_rules: + - name: "A to (invalid) Tee Action" + selector: + type: "QType" + qtype: "A" + action: + type: "Tee" + rca: "a:" + lca: "127.0.0.1" +""" + _yaml_config_params = ["_dnsDistPort", "_testServerPort"] + _config_params = [] + _enableStructuredLoggingOnCL = False + + def testFailToStart(self): + """ + YAML: Fails to start with an invalid ComboAddress raising a PDNSException from C++ via the Rust library + """ + pass + + @classmethod + def setUpClass(cls): + failed = False + try: + cls.startDNSDist() + except AssertionError as err: + failed = True + expected = "dnsdist --check-config failed (1): b\"Error while parsing YAML file configs/dnsdist_TestYamlInvalidComboAddress.yml: Unable to convert presentation address 'a:'\\n\"" + if str(err) != expected: + raise AssertionError("DNSdist should not start with an invalid ComboAddress in listen_address: %s" % (err)) + if not failed: + raise AssertionError("DNSdist should not start with an invalid ComboAddress in listen_address") + + @classmethod + def tearDownClass(cls): + if cls._dnsdist: + cls.killProcess(cls._dnsdist) + + class TestYamlLuaCodeUsingObjects(DNSDistTest): _yaml_config_template = """--- binds: