From: Remi Gacogne Date: Wed, 14 Dec 2022 15:19:49 +0000 (+0100) Subject: dnsdist: Stop the responders more quickly during the tests X-Git-Tag: dnsdist-1.8.0-rc1~161^2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=28d4c42d071c20332b6f10f11369d95be1cc21a2;p=thirdparty%2Fpdns.git 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. --- 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)