From a6c76ba3b896d20c04f6ad8a9af76f67a1d8720d Mon Sep 17 00:00:00 2001 From: Peter van Dijk Date: Mon, 8 Apr 2019 14:06:22 +0200 Subject: [PATCH] improve timer resolution --- regression-tests.dnsdist/test_TCPLimits.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/regression-tests.dnsdist/test_TCPLimits.py b/regression-tests.dnsdist/test_TCPLimits.py index 7652347d0..010c1c68b 100644 --- a/regression-tests.dnsdist/test_TCPLimits.py +++ b/regression-tests.dnsdist/test_TCPLimits.py @@ -106,11 +106,11 @@ 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) + time.sleep(0.5) conn.send(b'A') count = count + 1 except Exception as e: @@ -119,7 +119,7 @@ class TestTCPLimits(DNSDistTest): 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() -- 2.40.0