]> git.ipfire.org Git - thirdparty/pdns.git/blobdiff - regression-tests.dnsdist/test_TeeAction.py
Merge pull request #8945 from rgacogne/ddist-x-forwarded-for
[thirdparty/pdns.git] / regression-tests.dnsdist / test_TeeAction.py
index 905f348455428d2b4e9f4edac28d2ae4948b0d02..156dcda7be2965e47e10679538af5907c624fe83 100644 (file)
@@ -1,24 +1,23 @@
 #!/usr/bin/env python
 import base64
-import Queue
 import threading
 import clientsubnetoption
 import dns
-from dnsdisttests import DNSDistTest
+from dnsdisttests import DNSDistTest, Queue
 
 class TestTeeAction(DNSDistTest):
 
     _consoleKey = DNSDistTest.generateConsoleKey()
-    _consoleKeyB64 = base64.b64encode(_consoleKey)
+    _consoleKeyB64 = base64.b64encode(_consoleKey).decode('ascii')
     _teeServerPort = 5390
-    _toTeeQueue = Queue.Queue()
-    _fromTeeQueue = Queue.Queue()
+    _toTeeQueue = Queue()
+    _fromTeeQueue = Queue()
     _config_template = """
     setKey("%s")
     controlSocket("127.0.0.1:%s")
     newServer{address="127.0.0.1:%d"}
-    addAction(QTypeRule(dnsdist.A), TeeAction("127.0.0.1:%d", true))
-    addAction(QTypeRule(dnsdist.AAAA), TeeAction("127.0.0.1:%d", false))
+    addAction(QTypeRule(DNSQType.A), TeeAction("127.0.0.1:%d", true))
+    addAction(QTypeRule(DNSQType.AAAA), TeeAction("127.0.0.1:%d", false))
     """
     _config_params = ['_consoleKeyB64', '_consolePort', '_testServerPort', '_teeServerPort', '_teeServerPort']
     @classmethod
@@ -73,16 +72,16 @@ class TestTeeAction(DNSDistTest):
 
         # check the TeeAction stats
         stats = self.sendConsoleCommand("getAction(0):printStats()")
-        self.assertEquals(stats, """refuseds\t0
+        self.assertEquals(stats, """noerrors\t%d
 nxdomains\t0
-noerrors\t%d
-servfails\t0
+other-rcode\t0
+queries\t%d
 recv-errors\t0
-tcp-drops\t0
+refuseds\t0
 responses\t%d
-other-rcode\t0
 send-errors\t0
-queries\t%d
+servfails\t0
+tcp-drops\t0
 """ % (numberOfQueries, numberOfQueries, numberOfQueries))
 
     def testTeeWithoutECS(self):
@@ -121,14 +120,14 @@ queries\t%d
 
         # check the TeeAction stats
         stats = self.sendConsoleCommand("getAction(0):printStats()")
-        self.assertEquals(stats, """refuseds\t0
+        self.assertEquals(stats, """noerrors\t%d
 nxdomains\t0
-noerrors\t%d
-servfails\t0
+other-rcode\t0
+queries\t%d
 recv-errors\t0
-tcp-drops\t0
+refuseds\t0
 responses\t%d
-other-rcode\t0
 send-errors\t0
-queries\t%d
+servfails\t0
+tcp-drops\t0
 """ % (numberOfQueries, numberOfQueries, numberOfQueries))