X-Git-Url: http://git.ipfire.org/?a=blobdiff_plain;f=regression-tests.dnsdist%2Ftest_TCPLimits.py;h=ec20c929f5966591f857c55e9e0d9a2e52730f37;hb=b61cf2574a1c5b668375cf75e41ab64ce028dc01;hp=395ade98ca98b02dc736da6f8e691a396cb7b8a8;hpb=b4f237837277297f9f146005668856dcdbf6a1eb;p=thirdparty%2Fpdns.git diff --git a/regression-tests.dnsdist/test_TCPLimits.py b/regression-tests.dnsdist/test_TCPLimits.py index 395ade98ca..ec20c929f5 100644 --- a/regression-tests.dnsdist/test_TCPLimits.py +++ b/regression-tests.dnsdist/test_TCPLimits.py @@ -2,10 +2,20 @@ import struct import time import dns -from dnsdisttests import DNSDistTest, range +from dnsdisttests import DNSDistTest + +try: + range = xrange +except NameError: + pass class TestTCPLimits(DNSDistTest): + # this test suite uses a different responder port + # because it uses a different health check configuration + _testServerPort = 5395 + _answerUnexpected = True + _tcpIdleTimeout = 2 _maxTCPQueriesPerConn = 5 _maxTCPConnsPerClient = 3 @@ -96,19 +106,20 @@ class TestTCPLimits(DNSDistTest): conn.send(struct.pack("!H", 65535)) count = 0 - while count < (self._maxTCPConnDuration * 2): + while count < (self._maxTCPConnDuration * 20): try: # sleeping for only one second keeps us below the # idle timeout (setTCPRecvTimeout()) - time.sleep(1) - conn.send('A') + time.sleep(0.1) + conn.send(b'A') count = count + 1 - except: + except Exception as e: + print("Exception: %s!" % (e)) break end = time.time() - self.assertAlmostEquals(count, self._maxTCPConnDuration, delta=2) + self.assertAlmostEquals(count / 10, self._maxTCPConnDuration, delta=2) self.assertAlmostEquals(end - start, self._maxTCPConnDuration, delta=2) conn.close()