From 1ade83b2d19f0a67754be44546c13b3f862f3995 Mon Sep 17 00:00:00 2001 From: Remi Gacogne Date: Thu, 7 Jan 2016 14:27:51 +0100 Subject: [PATCH] dnsdist: upgrade nose, add timeouts in responder, be verbose --- .travis.yml | 2 +- regression-tests.dnsdist/dnscrypt.py | 4 ++-- regression-tests.dnsdist/dnsdisttests.py | 7 +++++-- regression-tests.dnsdist/requirements.txt | 2 +- 4 files changed, 9 insertions(+), 6 deletions(-) diff --git a/.travis.yml b/.travis.yml index 4d227861e..569ee6949 100644 --- a/.travis.yml +++ b/.travis.yml @@ -285,7 +285,7 @@ script: - ./testrunner - cp ./dnsdist ../../../regression-tests.dnsdist/ - cd ../../../regression-tests.dnsdist - - DNSDISTBIN=./dnsdist ./runtests + - DNSDISTBIN=./dnsdist ./runtests -v - rm -f ./dnsdist - rm -f ./DNSCryptResolver.cert ./DNSCryptResolver.key - cd .. diff --git a/regression-tests.dnsdist/dnscrypt.py b/regression-tests.dnsdist/dnscrypt.py index bb6689595..82957c50e 100644 --- a/regression-tests.dnsdist/dnscrypt.py +++ b/regression-tests.dnsdist/dnscrypt.py @@ -63,7 +63,7 @@ class DNSCryptClient: return result - def __init__(self, providerName, providerFingerprint, resolverAddress, resolverPort=443): + def __init__(self, providerName, providerFingerprint, resolverAddress, resolverPort=443, timeout=2): self._providerName = providerName self._providerFingerprint = providerFingerprint.lower().replace(':', '').decode('hex') self._resolverAddress = resolverAddress @@ -73,8 +73,8 @@ class DNSCryptClient: addrType = self._addrToSocketType(self._resolverAddress) self._sock = socket.socket(addrType, socket.SOCK_DGRAM) + self._sock.settimeout(timeout) self._sock.connect((self._resolverAddress, self._resolverPort)) - self._sock.settimeout(2) def _sendQuery(self, queryContent): self._sock.send(queryContent) diff --git a/regression-tests.dnsdist/dnsdisttests.py b/regression-tests.dnsdist/dnsdisttests.py index d6a58571b..f94735900 100644 --- a/regression-tests.dnsdist/dnsdisttests.py +++ b/regression-tests.dnsdist/dnsdisttests.py @@ -95,13 +95,13 @@ class DNSDistTest(unittest.TestCase): if cls._dnsdist.poll() is not None: cls._dnsdist.kill() - cls._dnsdist.wait() sys.exit(cls._dnsdist.returncode) @classmethod def setUpSockets(cls): print("Setting up UDP socket..") cls._sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) + cls._sock.settimeout(2.0) cls._sock.connect(("127.0.0.1", cls._dnsDistPort)) @classmethod @@ -125,7 +125,7 @@ class DNSDistTest(unittest.TestCase): time.sleep(delay) if cls._dnsdist.poll() is None: cls._dnsdist.kill() - cls._dnsdist.wait() + cls._dnsdist.wait() @classmethod def ResponderIncrementCounter(cls): @@ -169,7 +169,9 @@ class DNSDistTest(unittest.TestCase): if rrset: response.answer.append(rrset) + sock.settimeout(2.0) sock.sendto(response.to_wire(), addr) + sock.settimeout(None) sock.close() @classmethod @@ -185,6 +187,7 @@ class DNSDistTest(unittest.TestCase): sock.listen(100) while True: (conn, address) = sock.accept() + conn.settimeout(2.0) data = conn.recv(2) (datalen,) = struct.unpack("!H", data) data = conn.recv(datalen) diff --git a/regression-tests.dnsdist/requirements.txt b/regression-tests.dnsdist/requirements.txt index e33025f32..5521abf7c 100644 --- a/regression-tests.dnsdist/requirements.txt +++ b/regression-tests.dnsdist/requirements.txt @@ -1,3 +1,3 @@ dnspython>=1.11 -nose==1.3.0 +nose>=1.3.7 libnacl>=1.4.3 -- 2.40.0