Files
nousresearch--hermes-agent/tests/docker/test_smoke.py
T
wehub-resource-sync b4fbd6fe9f
Deploy Site / deploy-vercel (push) Has been skipped
Deploy Site / deploy-docs (push) Has been skipped
Build Skills Index / build-index (push) Has been skipped
CI / Deny unrelated histories (push) Has been skipped
CI / Detect affected areas (push) Successful in 27m35s
CI / OSV scan (push) Failing after 4s
CI / Build&Test Docker image (push) Successful in 9s
CI / Supply-chain scan (push) Has been skipped
CI / Lint Docker scripts (push) Failing after 5m13s
CI / Check contributors (push) Failing after 12m8s
CI / Docs Site (push) Failing after 12m8s
CI / TypeScript (push) Failing after 12m8s
CI / Python lints (push) Failing after 12m9s
CI / Python tests (push) Failing after 12m9s
CI / Check uv.lock (push) Failing after 23m22s
CI / CI timing report (push) Has been cancelled
Build Skills Index / trigger-deploy (push) Has been cancelled
CI / All required checks pass (push) Has been cancelled
chore: import upstream snapshot with attribution
2026-07-13 11:56:03 +08:00

61 lines
2.4 KiB
Python

"""Runtime smoke tests for the Docker image entrypoint and subcommands.
Converted from the former ``.github/actions/hermes-smoke-test`` composite
action. These tests exercise the image's real ENTRYPOINT (``/init`` +
``main-wrapper.sh``) via ``docker run --rm <image> --help`` and
``docker run --rm <image> dashboard --help`` to catch basic runtime
regressions before publishing.
The harness expects the ``built_image`` fixture from
``tests/docker/conftest.py``. When Docker isn't available every test
here is skipped at collection time.
"""
from __future__ import annotations
import subprocess
def test_hermes_help(built_image: str) -> None:
"""``docker run --rm <image> --help`` must exit 0.
Uses the image's real ENTRYPOINT (``/init`` + ``main-wrapper.sh``)
so this exercises the actual production startup path. PR #30136
review caught that an ``--entrypoint`` override in the old composite
action had been silently neutered by the s6-overlay migration —
``stage2-hook`` ignores CMD args passed after an overridden
entrypoint, so the smoke test was a no-op.
"""
r = subprocess.run(
["docker", "run", "--rm", built_image, "--help"],
capture_output=True, text=True, timeout=60,
)
assert r.returncode == 0, (
f"hermes --help failed (exit {r.returncode}): "
f"stdout={r.stdout[-2000:]!r} stderr={r.stderr[-2000:]!r}"
)
assert "Traceback" not in r.stderr, (
f"hermes --help produced a traceback: {r.stderr[-2000:]!r}"
)
def test_dashboard_subcommand_present(built_image: str) -> None:
"""``docker run --rm <image> dashboard --help`` must exit 0.
Regression guard for #9153: the ``dashboard`` subcommand was present
in source but missing from the published image. If this fails,
something in the Dockerfile is excluding the dashboard subcommand
from the installed package.
"""
r = subprocess.run(
["docker", "run", "--rm", built_image, "dashboard", "--help"],
capture_output=True, text=True, timeout=60,
)
assert r.returncode == 0, (
f"hermes dashboard --help failed (exit {r.returncode}): "
f"stdout={r.stdout[-2000:]!r} stderr={r.stderr[-2000:]!r}"
)
combined = (r.stdout + r.stderr).lower()
assert "dashboard" in combined or "usage" in combined, (
f"dashboard --help output unexpected: {combined[-2000:]!r}"
)