From 7860302414a444bd655be3759cdce7a478afb3f3 Mon Sep 17 00:00:00 2001 From: Peter van Dijk Date: Fri, 10 May 2019 19:01:45 +0200 Subject: [PATCH] dnsdist: make tests run on python 3 --- regression-tests.dnsdist/requirements.txt | 3 +-- regression-tests.dnsdist/test_Protobuf.py | 6 +++--- regression-tests.dnsdist/test_SNMP.py | 8 ++++---- 3 files changed, 8 insertions(+), 9 deletions(-) diff --git a/regression-tests.dnsdist/requirements.txt b/regression-tests.dnsdist/requirements.txt index 9aa49c366..42b871909 100644 --- a/regression-tests.dnsdist/requirements.txt +++ b/regression-tests.dnsdist/requirements.txt @@ -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 diff --git a/regression-tests.dnsdist/test_Protobuf.py b/regression-tests.dnsdist/test_Protobuf.py index f8345d209..103cd2234 100644 --- a/regression-tests.dnsdist/test_Protobuf.py +++ b/regression-tests.dnsdist/test_Protobuf.py @@ -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') diff --git a/regression-tests.dnsdist/test_SNMP.py b/regression-tests.dnsdist/test_SNMP.py index f177a6f9f..14c86cb00 100644 --- a/regression-tests.dnsdist/test_SNMP.py +++ b/regression-tests.dnsdist/test_SNMP.py @@ -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 -- 2.40.0