]> git.ipfire.org Git - thirdparty/pdns.git/blobdiff - regression-tests.dnsdist/test_TCPKeepAlive.py
Merge pull request #13914 from rgacogne/ddist-fix-xsk-error
[thirdparty/pdns.git] / regression-tests.dnsdist / test_TCPKeepAlive.py
index 984c7d1e0856b79f9957e1a06c6f7a71dcff7343..d456852786bc2fd5b8a7b446af2742bc761c6dda 100644 (file)
@@ -26,10 +26,10 @@ class TestTCPKeepAlive(DNSDistTest):
     setMaxTCPQueriesPerConnection(%s)
     setMaxTCPConnectionsPerClient(%s)
     setMaxTCPConnectionDuration(%s)
-    pc = newPacketCache(100, 86400, 1)
+    pc = newPacketCache(100, {maxTTL=86400, minTTL=1})
     getPool(""):setCache(pc)
-    addAction("largernumberofconnections.tcpka.tests.powerdns.com.", SkipCacheAction())
-    addAction("refused.tcpka.tests.powerdns.com.", RCodeAction(dnsdist.REFUSED))
+    addAction("largernumberofconnections.tcpka.tests.powerdns.com.", SetSkipCacheAction())
+    addAction("refused.tcpka.tests.powerdns.com.", RCodeAction(DNSRCode.REFUSED))
     addAction("dropped.tcpka.tests.powerdns.com.", DropAction())
     addResponseAction("dropped-response.tcpka.tests.powerdns.com.", DropResponseAction())
     -- create the pool named "nosuchpool"
@@ -45,6 +45,7 @@ class TestTCPKeepAlive(DNSDistTest):
         """
         name = 'refused.tcpka.tests.powerdns.com.'
         query = dns.message.make_query(name, 'A', 'IN')
+        query.flags &= ~dns.flags.RD
         expectedResponse = dns.message.make_response(query)
         expectedResponse.set_rcode(dns.rcode.REFUSED)
 
@@ -57,7 +58,7 @@ class TestTCPKeepAlive(DNSDistTest):
                 response = self.recvTCPResponseOverConnection(conn)
                 if response is None:
                     break
-                self.assertEquals(expectedResponse, response)
+                self.assertEqual(expectedResponse, response)
                 count = count + 1
             except:
                 pass
@@ -84,8 +85,8 @@ class TestTCPKeepAlive(DNSDistTest):
         self.assertTrue(receivedQuery)
         self.assertTrue(receivedResponse)
         receivedQuery.id = query.id
-        self.assertEquals(query, receivedQuery)
-        self.assertEquals(receivedResponse, expectedResponse)
+        self.assertEqual(query, receivedQuery)
+        self.assertEqual(receivedResponse, expectedResponse)
 
         conn = self.openTCPConnection()
 
@@ -96,7 +97,7 @@ class TestTCPKeepAlive(DNSDistTest):
                 response = self.recvTCPResponseOverConnection(conn)
                 if response is None:
                     break
-                self.assertEquals(expectedResponse, response)
+                self.assertEqual(expectedResponse, response)
                 count = count + 1
             except:
                 pass
@@ -126,7 +127,7 @@ class TestTCPKeepAlive(DNSDistTest):
                 response = self.recvTCPResponseOverConnection(conn)
                 if response is None:
                     break
-                self.assertEquals(expectedResponse, response)
+                self.assertEqual(expectedResponse, response)
                 count = count + 1
             except:
                 pass
@@ -238,7 +239,7 @@ class TestTCPKeepAlive(DNSDistTest):
                 response = self.recvTCPResponseOverConnection(conn)
                 if response is None:
                     break
-                self.assertEquals(expectedResponse, response)
+                self.assertEqual(expectedResponse, response)
                 count = count + 1
             except:
                 pass