From: Remi Gacogne Date: Tue, 1 Feb 2022 10:29:09 +0000 (+0100) Subject: dnsdist: Add a regression test for PoolAction's second option X-Git-Tag: auth-4.7.0-alpha1~30^2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=ac556d8415cdbb56dd679b49797a30e460ac26d6;p=thirdparty%2Fpdns.git dnsdist: Add a regression test for PoolAction's second option --- diff --git a/regression-tests.dnsdist/test_Routing.py b/regression-tests.dnsdist/test_Routing.py index b2dfc85403..fbe5a42320 100644 --- a/regression-tests.dnsdist/test_Routing.py +++ b/regression-tests.dnsdist/test_Routing.py @@ -10,6 +10,13 @@ class TestRoutingPoolRouting(DNSDistTest): _config_template = """ newServer{address="127.0.0.1:%s", pool="real"} addAction(makeRule("poolaction.routing.tests.powerdns.com"), PoolAction("real")) + -- by default PoolAction stops the processing so the second rule should not be executed + addAction(makeRule("poolaction.routing.tests.powerdns.com"), PoolAction("not-real")) + + -- this time we configure PoolAction to not stop the processing + addAction(makeRule("poolaction-nostop.routing.tests.powerdns.com"), PoolAction("no-real", false)) + -- so the second rule should be executed + addAction(makeRule("poolaction-nostop.routing.tests.powerdns.com"), PoolAction("real")) """ def testPolicyPoolAction(self): @@ -36,6 +43,27 @@ class TestRoutingPoolRouting(DNSDistTest): self.assertEqual(query, receivedQuery) self.assertEqual(response, receivedResponse) + def testPolicyPoolActionNoStop(self): + """ + Routing: Set pool by qname via PoolAction (no stop) + """ + name = 'poolaction-nostop.routing.tests.powerdns.com.' + query = dns.message.make_query(name, 'A', 'IN') + response = dns.message.make_response(query) + rrset = dns.rrset.from_text(name, + 60, + dns.rdataclass.IN, + dns.rdatatype.A, + '192.0.2.1') + response.answer.append(rrset) + + for method in ("sendUDPQuery", "sendTCPQuery"): + sender = getattr(self, method) + (receivedQuery, receivedResponse) = sender(query, response) + receivedQuery.id = query.id + self.assertEqual(query, receivedQuery) + self.assertEqual(response, receivedResponse) + def testDefaultPool(self): """ Routing: Set pool by qname canary