mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-07-15 14:22:43 +00:00
fix(cli): mock systemd preflight in gateway service tests for non-systemd environments (#15187)
Mock _preflight_user_systemd and _select_systemd_scope in
test_systemd_start_refreshes_outdated_unit and
test_systemd_restart_refreshes_outdated_unit. These tests target
unit-file refresh logic, not D-Bus reachability, so the preflight
check was causing spurious UserSystemdUnavailableError on macOS,
WSL, and Docker where systemd is unavailable.
(cherry picked from commit 34113300a1)
This commit is contained in:
parent
1d689e1920
commit
4ed910c689
1 changed files with 8 additions and 0 deletions
|
|
@ -68,6 +68,10 @@ class TestSystemdServiceRefresh:
|
|||
|
||||
monkeypatch.setattr(gateway_cli, "get_systemd_unit_path", lambda system=False: unit_path)
|
||||
monkeypatch.setattr(gateway_cli, "generate_systemd_unit", lambda system=False, run_as_user=None: "new unit\n")
|
||||
# Bypass systemd availability checks — this test targets unit-file
|
||||
# refresh logic, not D-Bus reachability (fails on macOS/WSL/Docker).
|
||||
monkeypatch.setattr(gateway_cli, "_preflight_user_systemd", lambda **kw: None)
|
||||
monkeypatch.setattr(gateway_cli, "_select_systemd_scope", lambda system=False: False)
|
||||
|
||||
calls = []
|
||||
|
||||
|
|
@ -91,6 +95,10 @@ class TestSystemdServiceRefresh:
|
|||
|
||||
monkeypatch.setattr(gateway_cli, "get_systemd_unit_path", lambda system=False: unit_path)
|
||||
monkeypatch.setattr(gateway_cli, "generate_systemd_unit", lambda system=False, run_as_user=None: "new unit\n")
|
||||
# Bypass systemd availability checks — this test targets unit-file
|
||||
# refresh logic, not D-Bus reachability (fails on macOS/WSL/Docker).
|
||||
monkeypatch.setattr(gateway_cli, "_preflight_user_systemd", lambda **kw: None)
|
||||
monkeypatch.setattr(gateway_cli, "_select_systemd_scope", lambda system=False: False)
|
||||
|
||||
calls = []
|
||||
monkeypatch.setattr("gateway.status.get_running_pid", lambda: None)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue