"""Harness: dashboard opt-in via HERMES_DASHBOARD. Today (tini): dashboard starts once when HERMES_DASHBOARD=1; if it crashes it stays dead. After Phase 2 (s6): dashboard starts once; if it crashes it is restarted under supervision. The restart-after-crash test lives in Phase 2 Task 2.5; this file only locks the opt-in surface (which must not change between tini and s6). Every ``docker exec`` here runs as the unprivileged ``hermes`` user (via :func:`docker_exec`/:func:`docker_exec_sh` in conftest), matching the realistic runtime context. See the conftest module docstring. """ from __future__ import annotations import json import time from tests.docker.conftest import docker_exec, docker_exec_sh, start_container, poll_container, _http_probe def test_dashboard_not_running_by_default( built_image: str, container_name: str, ) -> None: """Without HERMES_DASHBOARD, no dashboard process should be running.""" start_container(built_image, container_name, cmd="sleep 60") r = docker_exec(container_name, "pgrep", "-f", "hermes dashboard") # pgrep exits non-zero when no match found assert r.returncode != 0, ( "Dashboard should not be running without HERMES_DASHBOARD" ) # --------------------------------------------------------------------------- # OAuth auth-gate behaviour — regression guard for the dashboard-insecure # auto-injection bug. Pre-fix, the s6 run script appended `--insecure` # whenever `HERMES_DASHBOARD_HOST` was non-loopback, silently disabling # the OAuth gate on every container-deployed dashboard. The matching # static-text guard lives in tests/test_docker_home_override_scripts.py; # this is the behavioural end-to-end check. # ---------------------------------------------------------------------------