From: Stefan Eissing Date: Fri, 25 Mar 2022 13:25:51 +0000 (+0000) Subject: *) test/modules/tls: make proxy tests repeatable. X-Git-Tag: 2.5.0-alpha2-ci-test-only~435 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ae479ae567c8d18b0427bab9a4c4a729244f59ff;p=thirdparty%2Fapache%2Fhttpd.git *) test/modules/tls: make proxy tests repeatable. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1899197 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/test/modules/tls/conftest.py b/test/modules/tls/conftest.py index cde4be60714..9580307dfdc 100644 --- a/test/modules/tls/conftest.py +++ b/test/modules/tls/conftest.py @@ -18,6 +18,19 @@ def pytest_report_header(config, startdir): ) +def pytest_addoption(parser): + parser.addoption("--repeat", action="store", type=int, default=1, + help='Number of times to repeat each test') + parser.addoption("--all", action="store_true") + + +def pytest_generate_tests(metafunc): + if "repeat" in metafunc.fixturenames: + count = int(metafunc.config.getoption("repeat")) + metafunc.fixturenames.append('tmp_ct') + metafunc.parametrize('repeat', range(count)) + + @pytest.fixture(scope="package") def env(pytestconfig) -> TlsTestEnv: level = logging.INFO diff --git a/test/modules/tls/test_16_proxy_mixed.py b/test/modules/tls/test_16_proxy_mixed.py index a37c530ba2f..11b8efe0de5 100644 --- a/test/modules/tls/test_16_proxy_mixed.py +++ b/test/modules/tls/test_16_proxy_mixed.py @@ -1,3 +1,5 @@ +import time + import pytest from .conf import TlsTestConf @@ -9,7 +11,7 @@ class TestProxyMixed: def _class_scope(self, env): conf = TlsTestConf(env=env, extras={ 'base': [ - "LogLevel proxy:trace1 proxy_http:trace1 ssl:trace1 proxy_http2:trace1", + "LogLevel proxy:trace1 proxy_http:trace1 ssl:trace1 proxy_http2:trace1 http2:debug", "ProxyPreserveHost on", ], env.domain_a: [ @@ -34,10 +36,12 @@ class TestProxyMixed: conf.install() assert env.apache_restart() == 0 - def test_16_proxy_mixed_ssl_get(self, env): + def test_16_proxy_mixed_ssl_get(self, env, repeat): data = env.tls_get_json(env.domain_b, "/proxy-ssl/index.json") assert data == {'domain': env.domain_b} - def test_16_proxy_mixed_tls_get(self, env): + def test_16_proxy_mixed_tls_get(self, env, repeat): data = env.tls_get_json(env.domain_a, "/proxy-tls/index.json") + if data is None: + time.sleep(300) assert data == {'domain': env.domain_a}