]> granicus.if.org Git - pdns/commitdiff
dnsdist: make tests run on python 3
authorPeter van Dijk <peter.van.dijk@powerdns.com>
Fri, 10 May 2019 17:01:45 +0000 (19:01 +0200)
committerPeter van Dijk <peter.van.dijk@powerdns.com>
Wed, 12 Jun 2019 16:44:38 +0000 (18:44 +0200)
regression-tests.dnsdist/requirements.txt
regression-tests.dnsdist/test_Protobuf.py
regression-tests.dnsdist/test_SNMP.py

index 9aa49c3661516cb7298e9f1b90325ca77ed9b859..42b871909012e221b87cf64fca47c76978af8bad 100644 (file)
@@ -2,8 +2,7 @@ dnspython>=1.11,<1.16.0
 nose>=1.3.7
 libnacl>=1.4.3
 requests>=2.1.0
-protobuf>=2.5,<3.0; sys_platform != 'darwin' and sys_platform != 'openbsd6'
-protobuf>=3.0; sys_platform == 'darwin' or sys_platform == 'openbsd6'
+protobuf>=3.0
 pysnmp>=4.3.4
 future>=0.17.1
 pycurl>=7.43.0
index f8345d2092cb70f191758823f8484767c735d41e..103cd22349c95393767db0e8cd5f6d29d6d8405e 100644 (file)
@@ -409,7 +409,7 @@ class TestProtobufIPCipher(DNSDistProtobufTest):
         """
         name = 'query.protobuf-ipcipher.tests.powerdns.com.'
 
-        target = b'target.protobuf-ipcipher.tests.powerdns.com.'
+        target = 'target.protobuf-ipcipher.tests.powerdns.com.'
         query = dns.message.make_query(name, 'A', 'IN')
         response = dns.message.make_response(query)
 
@@ -450,7 +450,7 @@ class TestProtobufIPCipher(DNSDistProtobufTest):
         self.assertEquals(len(msg.response.rrs), 2)
         rr = msg.response.rrs[0]
         self.checkProtobufResponseRecord(rr, dns.rdataclass.IN, dns.rdatatype.CNAME, name, 3600)
-        self.assertEquals(rr.rdata, target)
+        self.assertEquals(rr.rdata.decode('ascii'), target)
         rr = msg.response.rrs[1]
         self.checkProtobufResponseRecord(rr, dns.rdataclass.IN, dns.rdatatype.A, target, 3600)
         self.assertEquals(socket.inet_ntop(socket.AF_INET, rr.rdata), '127.0.0.1')
@@ -476,7 +476,7 @@ class TestProtobufIPCipher(DNSDistProtobufTest):
         self.assertEquals(len(msg.response.rrs), 2)
         rr = msg.response.rrs[0]
         self.checkProtobufResponseRecord(rr, dns.rdataclass.IN, dns.rdatatype.CNAME, name, 3600)
-        self.assertEquals(rr.rdata, target)
+        self.assertEquals(rr.rdata.decode('ascii'), target)
         rr = msg.response.rrs[1]
         self.checkProtobufResponseRecord(rr, dns.rdataclass.IN, dns.rdatatype.A, target, 3600)
         self.assertEquals(socket.inet_ntop(socket.AF_INET, rr.rdata), '127.0.0.1')
index f177a6f9fd753c3b33613961921b04148b3e48a3..14c86cb00e938a6bbb29289c651c939675ac8067 100644 (file)
@@ -58,7 +58,7 @@ class TestSNMP(DNSDistTest):
             self.assertTrue(isinstance(results[oid], OctetString))
 
         ## name
-        self.assertEquals(results['1.3.6.1.4.1.43315.3.2.1.2.0'], "servername")
+        self.assertEquals(str(results['1.3.6.1.4.1.43315.3.2.1.2.0']), "servername")
         ## weight
         self.assertEquals(results['1.3.6.1.4.1.43315.3.2.1.4.0'], 1)
         ## outstanding
@@ -68,11 +68,11 @@ class TestSNMP(DNSDistTest):
         ## reused
         self.assertEquals(results['1.3.6.1.4.1.43315.3.2.1.7.0'], 0)
         ## state
-        self.assertEquals(results['1.3.6.1.4.1.43315.3.2.1.8.0'], "up")
+        self.assertEquals(str(results['1.3.6.1.4.1.43315.3.2.1.8.0']), "up")
         ## address
-        self.assertEquals(results['1.3.6.1.4.1.43315.3.2.1.9.0'], ("127.0.0.1:%s" % (self._testServerPort)))
+        self.assertEquals(str(results['1.3.6.1.4.1.43315.3.2.1.9.0']), ("127.0.0.1:%s" % (self._testServerPort)))
         ## pools
-        self.assertEquals(results['1.3.6.1.4.1.43315.3.2.1.10.0'], "")
+        self.assertEquals(str(results['1.3.6.1.4.1.43315.3.2.1.10.0']), "")
         ## queries
         self.assertEquals(results['1.3.6.1.4.1.43315.3.2.1.12.0'], queriesCountersValue)
         ## order