test(docker): apply 180s timeout to docker harness tests

The agent-test suite default is 30s; docker test_no_args (the dashboard
spin-up, the container restart) routinely take 60-90s. Without this
they intermittently fail in CI with TimeoutError.
This commit is contained in:
Ben 2026-05-21 14:03:13 +10:00 committed by teknium1
parent 6e6acdea2a
commit a18f69eb55
No known key found for this signature in database

View file

@ -7,6 +7,10 @@ and exercise it via ``docker run``. They skip when Docker is unavailable
Override the image with ``HERMES_TEST_IMAGE`` env var to point at a pre-built
image (faster local iteration); otherwise the ``built_image`` fixture builds
the repo's Dockerfile once per session.
Docker tests need longer timeouts than the suite default (30s), so every
test under this directory is granted a 180s default via
``pytest.mark.timeout`` applied at collection time.
"""
from __future__ import annotations
@ -34,14 +38,17 @@ def _docker_available() -> bool:
def pytest_collection_modifyitems(config, items): # noqa: D401 - pytest hook
"""Skip every test under tests/docker/ when docker is unavailable."""
if _docker_available():
return
"""Apply docker-suite policy: timeout bump + skip on missing docker."""
docker_ok = _docker_available()
skip_docker = pytest.mark.skip(
reason="Docker not available or daemon not running",
)
extend_timeout = pytest.mark.timeout(180)
for item in items:
if "tests/docker/" in str(item.fspath).replace(os.sep, "/"):
if "tests/docker/" not in str(item.fspath).replace(os.sep, "/"):
continue
item.add_marker(extend_timeout)
if not docker_ok:
item.add_marker(skip_docker)