From: Remi Gacogne Date: Fri, 24 Mar 2023 09:45:08 +0000 (+0100) Subject: dnsdist: Wait for the API port to be available before running the tests X-Git-Tag: dnsdist-1.8.0^2~3 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=648edcba555e476fa1ff90d703c7e2c69f1b5643;p=thirdparty%2Fpdns.git dnsdist: Wait for the API port to be available before running the tests --- diff --git a/regression-tests.dnsdist/test_API.py b/regression-tests.dnsdist/test_API.py index bf8684183b..f708f9c4c1 100644 --- a/regression-tests.dnsdist/test_API.py +++ b/regression-tests.dnsdist/test_API.py @@ -41,6 +41,15 @@ class APITestsBase(DNSDistTest): 'doh-query-pipe-full', 'doh-response-pipe-full', 'proxy-protocol-invalid', 'tcp-listen-overflows', 'outgoing-doh-query-pipe-full', 'tcp-query-pipe-full', 'tcp-cross-protocol-query-pipe-full', 'tcp-cross-protocol-response-pipe-full'] + _verboseMode = True + + @classmethod + def setUpClass(cls): + cls.startResponders() + cls.startDNSDist() + cls.setUpSockets() + cls.waitForTCPSocket('127.0.0.1', cls._webServerPort) + print("Launching tests..") class TestAPIBasics(APITestsBase): diff --git a/regression-tests.dnsdist/test_Metrics.py b/regression-tests.dnsdist/test_Metrics.py index 5850d95425..d907b11354 100644 --- a/regression-tests.dnsdist/test_Metrics.py +++ b/regression-tests.dnsdist/test_Metrics.py @@ -39,6 +39,14 @@ class TestRuleMetrics(DNSDistTest): _dohBaseURL = ("https://%s:%d/" % (_serverName, _dohServerPort)) _config_params = ['_tlsServerPort', '_serverCert', '_serverKey', '_dohServerPort', '_serverCert', '_serverKey', '_testServerPort', '_webServerPort', '_webServerAPIKeyHashed'] + @classmethod + def setUpClass(cls): + cls.startResponders() + cls.startDNSDist() + cls.setUpSockets() + cls.waitForTCPSocket('127.0.0.1', cls._webServerPort) + print("Launching tests..") + def getMetric(self, name): headers = {'x-api-key': self._webServerAPIKey} url = 'http://127.0.0.1:' + str(self._webServerPort) + '/api/v1/servers/localhost'