*) 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
This commit is contained in:
Stefan Eissing
2022-03-25 13:25:51 +00:00
parent 8f642ea436
commit ae479ae567
2 changed files with 20 additions and 3 deletions

View File

@ -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") @pytest.fixture(scope="package")
def env(pytestconfig) -> TlsTestEnv: def env(pytestconfig) -> TlsTestEnv:
level = logging.INFO level = logging.INFO

View File

@ -1,3 +1,5 @@
import time
import pytest import pytest
from .conf import TlsTestConf from .conf import TlsTestConf
@ -9,7 +11,7 @@ class TestProxyMixed:
def _class_scope(self, env): def _class_scope(self, env):
conf = TlsTestConf(env=env, extras={ conf = TlsTestConf(env=env, extras={
'base': [ '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", "ProxyPreserveHost on",
], ],
env.domain_a: [ env.domain_a: [
@ -34,10 +36,12 @@ class TestProxyMixed:
conf.install() conf.install()
assert env.apache_restart() == 0 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") data = env.tls_get_json(env.domain_b, "/proxy-ssl/index.json")
assert data == {'domain': env.domain_b} 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") 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} assert data == {'domain': env.domain_a}