]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
dnsdist: Add a regression test for PoolAction's second option 11174/head
authorRemi Gacogne <remi.gacogne@powerdns.com>
Tue, 1 Feb 2022 10:29:09 +0000 (11:29 +0100)
committerRemi Gacogne <remi.gacogne@powerdns.com>
Tue, 1 Feb 2022 10:29:09 +0000 (11:29 +0100)
regression-tests.dnsdist/test_Routing.py

index b2dfc854037c422093e1a5f5c390f5fd3f1ad25a..fbe5a42320e817d08b3f98ae808e3c44b56b7bb3 100644 (file)
@@ -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