From: Remi Gacogne Date: Thu, 14 Dec 2017 12:48:28 +0000 (+0100) Subject: rec: Don't stop the reactor in the regression tests X-Git-Tag: rec-4.1.1~4^2 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=d023146c302c68d18aacfb518e6e4b437b0c1cef;p=pdns rec: Don't stop the reactor in the regression tests So, there is one and only one global reactor for every test suites, ever, and you can't restart it if you stop it (see the awful `ReactorNotRestartable` exception). That doesn't prevent you from adding new ports to listen on to the existing one, so let's just start if it isn't already running and never stop it. (cherry picked from commit fbfaa4a7ee59829cbf2d3765a3a967edb823bb39) --- diff --git a/regression-tests.recursor-dnssec/test_ECS.py b/regression-tests.recursor-dnssec/test_ECS.py index f4d351db6..e3c9e0c61 100644 --- a/regression-tests.recursor-dnssec/test_ECS.py +++ b/regression-tests.recursor-dnssec/test_ECS.py @@ -70,7 +70,7 @@ disable-syslog=yes ecsReactorRunning = True if not reactor.running: - cls._UDPResponder = threading.Thread(name='UDP ECS Responder', target=reactor.run, args=(False,)) + cls._UDPResponder = threading.Thread(name='UDP Responder', target=reactor.run, args=(False,)) cls._UDPResponder.setDaemon(True) cls._UDPResponder.start() diff --git a/regression-tests.recursor-dnssec/test_Interop.py b/regression-tests.recursor-dnssec/test_Interop.py index 3462ee267..9b670eac6 100644 --- a/regression-tests.recursor-dnssec/test_Interop.py +++ b/regression-tests.recursor-dnssec/test_Interop.py @@ -135,10 +135,6 @@ forward-zones+=undelegated.insecure.example=%s.12 cls._UDPResponder.setDaemon(True) cls._UDPResponder.start() - @classmethod - def tearDownResponders(cls): - reactor.stop() - class UDPResponder(DatagramProtocol): def datagramReceived(self, datagram, address): request = dns.message.from_wire(datagram) diff --git a/regression-tests.recursor-dnssec/test_LargeAnswer.py b/regression-tests.recursor-dnssec/test_LargeAnswer.py index c8300dc28..866564ff6 100644 --- a/regression-tests.recursor-dnssec/test_LargeAnswer.py +++ b/regression-tests.recursor-dnssec/test_LargeAnswer.py @@ -37,28 +37,10 @@ udp-truncation-threshold=%d largeReactorRunning = True if not reactor.running: - cls._UDPResponder = threading.Thread(name='UDP Large Responder', target=reactor.run, args=(False,)) + cls._UDPResponder = threading.Thread(name='UDP Responder', target=reactor.run, args=(False,)) cls._UDPResponder.setDaemon(True) cls._UDPResponder.start() - @classmethod - def setUpClass(cls): - cls.setUpSockets() - - cls.startResponders() - - confdir = os.path.join('configs', cls._confdir) - cls.createConfigDir(confdir) - - cls.generateRecursorConfig(confdir) - cls.startRecursor(confdir, cls._recursorPort) - - print("Launching tests..") - - @classmethod - def tearDownClass(cls): - cls.tearDownRecursor() - def checkResponseContent(self, rawResponse, value): self.assertEquals(len(rawResponse), self._udpTruncationThreshold) response = dns.message.from_wire(rawResponse)