From 28d4c42d071c20332b6f10f11369d95be1cc21a2 Mon Sep 17 00:00:00 2001 From: Remi Gacogne Date: Wed, 14 Dec 2022 16:19:49 +0100 Subject: [PATCH] dnsdist: Stop the responders more quickly during the tests We use `SO_REUSEPORT` in these tests so if the old responder is still around when the next test starts, it is quite likely that it might get one of the new queries. This is usually fine because responders with a different behaviour listen on different ports, but if a query is queued to an old responder socket right during the time that responder is checking whether it should stop and the actual exit, the query will be lost. --- regression-tests.dnsdist/dnsdisttests.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/regression-tests.dnsdist/dnsdisttests.py b/regression-tests.dnsdist/dnsdisttests.py index a11f6d1369..7ef003946b 100644 --- a/regression-tests.dnsdist/dnsdisttests.py +++ b/regression-tests.dnsdist/dnsdisttests.py @@ -247,7 +247,7 @@ class DNSDistTest(AssertEqualDNSMessageMixin, unittest.TestCase): sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEPORT, 1) sock.bind(("127.0.0.1", port)) - sock.settimeout(1.0) + sock.settimeout(0.5) while True: try: data, addr = sock.recvfrom(4096) @@ -363,7 +363,7 @@ class DNSDistTest(AssertEqualDNSMessageMixin, unittest.TestCase): sys.exit(1) sock.listen(100) - sock.settimeout(1.0) + sock.settimeout(0.5) if tlsContext: sock = tlsContext.wrap_socket(sock, server_side=True) @@ -506,7 +506,7 @@ class DNSDistTest(AssertEqualDNSMessageMixin, unittest.TestCase): sys.exit(1) sock.listen(100) - sock.settimeout(1.0) + sock.settimeout(0.5) if tlsContext: sock = tlsContext.wrap_socket(sock, server_side=True) -- 2.47.2