From: Remi Gacogne Date: Mon, 22 Jun 2020 15:16:27 +0000 (+0200) Subject: dnsdist: Debug failures in the TCP Limits regression test on Circle X-Git-Tag: dnsdist-1.5.0-rc4~11^2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=refs%2Fpull%2F9269%2Fhead;p=thirdparty%2Fpdns.git dnsdist: Debug failures in the TCP Limits regression test on Circle This test keeps failing on Circle CI but never locally, so let's try to add some debug. --- diff --git a/regression-tests.dnsdist/dnsdisttests.py b/regression-tests.dnsdist/dnsdisttests.py index 8765ea5844..773d5732ff 100644 --- a/regression-tests.dnsdist/dnsdisttests.py +++ b/regression-tests.dnsdist/dnsdisttests.py @@ -58,6 +58,7 @@ class DNSDistTest(AssertEqualDNSMessageMixin, unittest.TestCase): _healthCheckCounter = 0 _answerUnexpected = True _checkConfigExpectedOutput = None + _verboseMode = False @classmethod def startResponders(cls): @@ -82,6 +83,9 @@ class DNSDistTest(AssertEqualDNSMessageMixin, unittest.TestCase): dnsdistcmd = [os.environ['DNSDISTBIN'], '--supervised', '-C', confFile, '-l', '%s:%d' % (cls._dnsDistListeningAddr, cls._dnsDistPort) ] + if cls._verboseMode: + dnsdistcmd.append('-v') + for acl in cls._acl: dnsdistcmd.extend(['--acl', acl]) print(' '.join(dnsdistcmd)) @@ -96,7 +100,7 @@ class DNSDistTest(AssertEqualDNSMessageMixin, unittest.TestCase): expectedOutput = cls._checkConfigExpectedOutput else: expectedOutput = ('Configuration \'%s\' OK!\n' % (confFile)).encode() - if output != expectedOutput: + if not cls._verboseMode and output != expectedOutput: raise AssertionError('dnsdist --check-config failed: %s' % output) logFile = os.path.join('configs', 'dnsdist_%s.log' % (cls.__name__)) diff --git a/regression-tests.dnsdist/test_TCPLimits.py b/regression-tests.dnsdist/test_TCPLimits.py index ec20c929f5..17bc9a5fb1 100644 --- a/regression-tests.dnsdist/test_TCPLimits.py +++ b/regression-tests.dnsdist/test_TCPLimits.py @@ -28,6 +28,7 @@ class TestTCPLimits(DNSDistTest): setMaxTCPConnectionDuration(%s) """ _config_params = ['_testServerPort', '_tcpIdleTimeout', '_maxTCPQueriesPerConn', '_maxTCPConnsPerClient', '_maxTCPConnDuration'] + _verboseMode = True def testTCPQueriesPerConn(self): """ @@ -91,6 +92,11 @@ class TestTCPLimits(DNSDistTest): for conn in conns: conn.close() + # wait a bit to be sure that dnsdist closed the connections + # and decremented the counters on its side, otherwise subsequent + # connections will be dropped + time.sleep(1) + self.assertEqual(count, self._maxTCPConnsPerClient) self.assertEqual(failed, 1)