From 4d64fe7605d8d4a782b3805739546913aefb2024 Mon Sep 17 00:00:00 2001 From: Jean-Frederic Clere Date: Sat, 14 Nov 2026 17:23:56 +0100 Subject: [PATCH] Arrange 3 tests. --- test/modules/dav/test_004_lock_timeout_overflow.py | 6 ++++++ test/modules/http3/env.py | 12 ++++++++++++ test/modules/http3/test_016_cid_routing.py | 2 ++ test/modules/metadata/test_004_remoteip.py | 13 ++++++++++++- 4 files changed, 32 insertions(+), 1 deletion(-) diff --git a/test/modules/dav/test_004_lock_timeout_overflow.py b/test/modules/dav/test_004_lock_timeout_overflow.py index 600a44b3d31..2895a79f55d 100644 --- a/test/modules/dav/test_004_lock_timeout_overflow.py +++ b/test/modules/dav/test_004_lock_timeout_overflow.py @@ -1,3 +1,4 @@ +import glob import os import re @@ -32,6 +33,11 @@ def _class_scope(self, env): with open(os.path.join(dav_dir, name), 'w') as fd: fd.write('hello\n') + # the locks outlive the server: file1.txt stays locked for 2^32-1 + # seconds, so a lock database left by an earlier run answers 423 + for f in glob.glob(f"{env.gen_dir}/davlock-timeout-overflow*"): + os.remove(f) + conf = HttpdConf(env, extras={ 'base': f""" DavLockDB "{env.gen_dir}/davlock-timeout-overflow" diff --git a/test/modules/http3/env.py b/test/modules/http3/env.py index df624513ad0..2ad298e5681 100644 --- a/test/modules/http3/env.py +++ b/test/modules/http3/env.py @@ -76,6 +76,18 @@ def __init__(self, pytestconfig=None): def setup_httpd(self, setup: HttpdTestSetup = None): super().setup_httpd(setup=H3TestSetup(env=self)) + @property + def h3_ossl_backend(self) -> bool: + """Whether mod_http3 runs on OpenSSL's own QUIC stack + (--with-http3-quic=openssl) and not on ngtcp2, which has no 0-RTT, + connection ID routing or connection migration.""" + path = os.path.join(self.LIBEXEC_DIR, "mod_http3.so") + try: + with open(path, "rb") as fd: + return b"ngtcp2" not in fd.read() + except OSError: + return False + @property def h3_port(self) -> int: # the QUIC listener shares the number of the TLS port, over UDP diff --git a/test/modules/http3/test_016_cid_routing.py b/test/modules/http3/test_016_cid_routing.py index ca2b937e397..039c3f7e22f 100644 --- a/test/modules/http3/test_016_cid_routing.py +++ b/test/modules/http3/test_016_cid_routing.py @@ -101,6 +101,8 @@ class TestCidRouting: @pytest.fixture(autouse=True, scope="class") def _class_scope(self, env): + if env.h3_ossl_backend: + pytest.skip("routing by connection ID needs the ngtcp2 backend") cpus = os.cpu_count() or 1 if cpus < 2: pytest.skip("two buckets need two cores") diff --git a/test/modules/metadata/test_004_remoteip.py b/test/modules/metadata/test_004_remoteip.py index 48f81a463a3..9b312885d01 100644 --- a/test/modules/metadata/test_004_remoteip.py +++ b/test/modules/metadata/test_004_remoteip.py @@ -279,6 +279,9 @@ def remote_port_install(self, env): f"RemoteIPInternalProxy {self.PEER}"] + exposed) conf.end_vhost() conf.install() + # drop what an earlier test logged, so that remote_port_clear_log() + # waits for the probe of this restart and not for a stale line + open(os.path.join(env.server_logs_dir, self.LOG_FILE), 'w').close() assert env.apache_restart() == 0 def remote_port_logged(self, env): @@ -293,7 +296,15 @@ def remote_port_logged(self, env): return lines[0] def remote_port_clear_log(self, env): - open(os.path.join(env.server_logs_dir, self.LOG_FILE), 'w').close() + # The readiness probe of apache_restart() is logged after its + # response is sent, so it can land after the restart returned: + # wait for that line, or it would be taken for the test's own. + log_path = os.path.join(env.server_logs_dir, self.LOG_FILE) + for _ in range(20): + if os.path.getsize(log_path) > 0: + break + time.sleep(0.1) + open(log_path, 'w').close() # PROXY protocol: the client's port is known (4321 in PP2_ADDRS) and # every place must report it, not the proxy's TCP source port.