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:
@@ -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
|
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
|
image (faster local iteration); otherwise the ``built_image`` fixture builds
|
||||||
the repo's Dockerfile once per session.
|
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
|
from __future__ import annotations
|
||||||
|
|
||||||
@@ -34,14 +38,17 @@ def _docker_available() -> bool:
|
|||||||
|
|
||||||
|
|
||||||
def pytest_collection_modifyitems(config, items): # noqa: D401 - pytest hook
|
def pytest_collection_modifyitems(config, items): # noqa: D401 - pytest hook
|
||||||
"""Skip every test under tests/docker/ when docker is unavailable."""
|
"""Apply docker-suite policy: timeout bump + skip on missing docker."""
|
||||||
if _docker_available():
|
docker_ok = _docker_available()
|
||||||
return
|
|
||||||
skip_docker = pytest.mark.skip(
|
skip_docker = pytest.mark.skip(
|
||||||
reason="Docker not available or daemon not running",
|
reason="Docker not available or daemon not running",
|
||||||
)
|
)
|
||||||
|
extend_timeout = pytest.mark.timeout(180)
|
||||||
for item in items:
|
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)
|
item.add_marker(skip_docker)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user