From: Remi Gacogne Date: Thu, 15 May 2025 13:48:37 +0000 (+0200) Subject: dnsdist: Fix a flaky Proxy Protocol regression test X-Git-Tag: dnsdist-2.0.0-alpha2~14^2~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5d1decd070d8061454bdce2f34ca47b275883058;p=thirdparty%2Fpdns.git dnsdist: Fix a flaky Proxy Protocol regression test --- diff --git a/regression-tests.dnsdist/test_ProxyProtocol.py b/regression-tests.dnsdist/test_ProxyProtocol.py index a41a65b8b0..3085d30c7b 100644 --- a/regression-tests.dnsdist/test_ProxyProtocol.py +++ b/regression-tests.dnsdist/test_ProxyProtocol.py @@ -416,8 +416,11 @@ class TestProxyProtocol(ProxyProtocolTest): query = dns.message.make_query(name, 'A', 'IN') response = dns.message.make_response(query) - new_conn_before = self.getServerStats()[0]['tcpNewConnections'] - reused_conn_before = self.getServerStats()[0]['tcpReusedConnections'] + stats = self.getServerStats()[0] + max_conns_before = stats['tcpMaxConcurrentConnections'] + current_conns_before = stats['tcpCurrentConnections'] + new_conn_before = stats['tcpNewConnections'] + reused_conn_before = stats['tcpReusedConnections'] conn = self.openTCPConnection(2.0) data = query.to_wire() @@ -450,7 +453,12 @@ class TestProxyProtocol(ProxyProtocolTest): server = self.getServerStats()[0] self.assertEqual(server['tcpNewConnections'], new_conn_before + number_of_queries) self.assertEqual(server['tcpReusedConnections'], reused_conn_before) - self.assertEqual(server['tcpMaxConcurrentConnections'], 1) + # in some cases existing (before this test) connections to the backend might still + # exist, so we cannot enforce a strict "only 1 connection" check + self.assertLessEqual(server['tcpMaxConcurrentConnections'], max_conns_before + 1) + # but if we managed to add more than one connection to the existing ones, something is + # wrong! + self.assertLessEqual(server['tcpMaxConcurrentConnections'], current_conns_before + 1) class TestProxyProtocolIncoming(ProxyProtocolTest): """