From 110624def89a6a9af2b9516cfadee442523cd355 Mon Sep 17 00:00:00 2001 From: Remi Gacogne Date: Thu, 1 Feb 2024 14:46:11 +0100 Subject: [PATCH] dnsdist: Reduce the timeout on Dynamic Block tests expected to fail --- regression-tests.dnsdist/dnsdistDynBlockTests.py | 10 +++++----- regression-tests.dnsdist/dnsdisttests.py | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/regression-tests.dnsdist/dnsdistDynBlockTests.py b/regression-tests.dnsdist/dnsdistDynBlockTests.py index 27b4f3cfa9..f9acc85952 100644 --- a/regression-tests.dnsdist/dnsdistDynBlockTests.py +++ b/regression-tests.dnsdist/dnsdistDynBlockTests.py @@ -78,7 +78,7 @@ class DynBlocksTest(DNSDistTest): waitForMaintenanceToRun() # we should now be dropped for up to self._dynBlockDuration + self._dynBlockPeriod - (_, receivedResponse) = self.sendUDPQuery(query, response=None, useQueue=False, timeout=1) + (_, receivedResponse) = self.sendUDPQuery(query, response=None, useQueue=False, timeout=0.5) self.assertEqual(receivedResponse, None) if testViaAPI: @@ -117,7 +117,7 @@ class DynBlocksTest(DNSDistTest): waitForMaintenanceToRun() # we should now be dropped for up to self._dynBlockDuration + self._dynBlockPeriod - (_, receivedResponse) = self.sendTCPQuery(query, response=None, useQueue=False) + (_, receivedResponse) = self.sendTCPQuery(query, response=None, useQueue=False, timeout=0.5) self.assertEqual(receivedResponse, None) # wait until we are not blocked anymore @@ -294,7 +294,7 @@ class DynBlocksTest(DNSDistTest): allowed = 0 sent = 0 for _ in range(int(dynBlockBytesPerSecond * 5 / len(response.to_wire()))): - (receivedQuery, receivedResponse) = self.sendTCPQuery(query, response) + (receivedQuery, receivedResponse) = self.sendTCPQuery(query, response, timeout=0.5) sent = sent + len(response.to_wire()) if receivedQuery: receivedQuery.id = query.id @@ -429,7 +429,7 @@ class DynBlocksTest(DNSDistTest): waitForMaintenanceToRun() # we should now be dropped for up to self._dynBlockDuration + self._dynBlockPeriod - (_, receivedResponse) = self.sendTCPQuery(query, response=None, useQueue=False) + (_, receivedResponse) = self.sendTCPQuery(query, response=None, useQueue=False, timeout=0.5) self.assertEqual(receivedResponse, None) # wait until we are not blocked anymore @@ -536,7 +536,7 @@ class DynBlocksTest(DNSDistTest): waitForMaintenanceToRun() # we should now be dropped for up to self._dynBlockDuration + self._dynBlockPeriod - (_, receivedResponse) = self.sendTCPQuery(query, response=None, useQueue=False) + (_, receivedResponse) = self.sendTCPQuery(query, response=None, useQueue=False, timeout=0.5) self.assertEqual(receivedResponse, None) # wait until we are not blocked anymore diff --git a/regression-tests.dnsdist/dnsdisttests.py b/regression-tests.dnsdist/dnsdisttests.py index ef2dc35364..96d3caf3e4 100644 --- a/regression-tests.dnsdist/dnsdisttests.py +++ b/regression-tests.dnsdist/dnsdisttests.py @@ -705,8 +705,8 @@ class DNSDistTest(AssertEqualDNSMessageMixin, unittest.TestCase): return (None, None) try: - cls.sendTCPQueryOverConnection(sock, query, rawQuery) - message = cls.recvTCPResponseOverConnection(sock) + cls.sendTCPQueryOverConnection(sock, query, rawQuery, timeout=timeout) + message = cls.recvTCPResponseOverConnection(sock, timeout=timeout) except socket.timeout as e: print("Timeout while sending or receiving TCP data: %s" % (str(e))) except socket.error as e: -- 2.47.2