]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
dnsdist: Debug failures in the TCP Limits regression test on Circle 9269/head
authorRemi Gacogne <remi.gacogne@powerdns.com>
Mon, 22 Jun 2020 15:16:27 +0000 (17:16 +0200)
committerRemi Gacogne <remi.gacogne@powerdns.com>
Mon, 22 Jun 2020 15:16:27 +0000 (17:16 +0200)
This test keeps failing on Circle CI but never locally, so let's try
to add some debug.

regression-tests.dnsdist/dnsdisttests.py
regression-tests.dnsdist/test_TCPLimits.py

index 8765ea58445658ea0ac95288b08f19d6933c98f8..773d5732ffa486e62c757f2e8116d8642fd1fb48 100644 (file)
@@ -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__))
index ec20c929f5966591f857c55e9e0d9a2e52730f37..17bc9a5fb1094ee4b829ecb3c895b6bac00ca2d5 100644 (file)
@@ -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)