Skip to content

The agent that grows with you

test(update): pin hermes-dashboard* coverage in both systemd restart passes

Yuan Li0ff72259186f
diff --git a/tests/hermes_cli/test_update_fleet_restart_timeout.py b/tests/hermes_cli/test_update_fleet_restart_timeout.py
index 948daba3791..43a03a4a7af 100644
--- a/tests/hermes_cli/test_update_fleet_restart_timeout.py
+++ b/tests/hermes_cli/test_update_fleet_restart_timeout.py
@@ -108,6 +108,44 @@ class TestFleetRestartTimeoutIsolation:
assert seen == ["hermes-serve", "hermes-serve-work", "hermes-gateway"]
+ def test_hermes_dashboard_units_are_included(self):
+ # #125297 — the same blind spot for the systemd-supervised dashboard: the
+ # unit pass skipped hermes-dashboard*, so a successful update left the
+ # dashboard on pre-update code with outcome "deferred" and nothing
+ # restarted it. Reconciliation already credits hermes-dashboard{,-<profile>}
+ # unit restarts; the pass must produce one.
+ seen: list[str] = []
+
+ _for_each_systemd_gateway_unit(
+ "\n".join(
+ [
+ "ssh.service loaded active running",
+ "hermes-dashboard.service loaded active running",
+ "hermes-dashboard-work.service loaded active running",
+ "hermes-serve.service loaded active running",
+ "",
+ ]
+ ),
+ process_unit=seen.append,
+ on_unit_timeout=lambda *_: pytest.fail("unexpected timeout"),
+ )
+
+ assert seen == ["hermes-dashboard", "hermes-dashboard-work", "hermes-serve"]
+
+ def test_hermes_dashboard_near_prefix_is_rejected(self):
+ # Same strict shape on the dashboard side: a bare
+ # ``startswith("hermes-dashboard")`` gate would also accept the
+ # unrelated ``hermes-dashboardd.service``.
+ seen: list[str] = []
+
+ _for_each_systemd_gateway_unit(
+ _list_units_stdout(["hermes-dashboardd", "hermes-dashboard-work"]),
+ process_unit=seen.append,
+ on_unit_timeout=lambda *_: pytest.fail("unexpected timeout"),
+ )
+
+ assert seen == ["hermes-dashboard-work"]
+
def test_hermes_server_near_prefix_is_rejected(self):
# Review on #83595: a bare ``startswith("hermes-serve")`` gate also
# accepts the unrelated ``hermes-server.service``. Only the exact
diff --git a/tests/hermes_cli/test_update_serve_generation_recovery.py b/tests/hermes_cli/test_update_serve_generation_recovery.py
index 4413ae93b7e..5dc1486af34 100644
--- a/tests/hermes_cli/test_update_serve_generation_recovery.py
+++ b/tests/hermes_cli/test_update_serve_generation_recovery.py
@@ -471,6 +471,22 @@ def test_gateway_units_are_not_restarted_by_the_serve_pass(linux_systemctl):
assert out == {"verified": [], "failed": []}
+def test_dashboard_unit_is_restarted_and_verified_by_the_serve_pass(linux_systemctl):
+ """#125297: a systemd-supervised dashboard is the same stale-generation risk
+ as a serve unit — the abort-recovery pass must enumerate and restart it too."""
+ fake = _Systemctl(
+ listed=["hermes-serve.service", "hermes-dashboard-work.service"],
+ active={"hermes-serve.service": True, "hermes-dashboard-work.service": True},
+ main_pids={"hermes-serve.service": 7, "hermes-dashboard-work.service": 8},
+ )
+ out = recovery.restart_serve_units(run=fake, sleep=lambda _: None)
+ assert fake.restarted == ["hermes-serve.service", "hermes-dashboard-work.service"]
+ assert out == {
+ "verified": ["user/hermes-dashboard-work", "user/hermes-serve"],
+ "failed": [],
+ }
+
+
def test_no_systemctl_means_no_serve_pass(monkeypatch):
monkeypatch.setattr(recovery.shutil, "which", lambda name: None)