This commit is contained in:
Allan Ditzel 2026-04-24 17:28:32 -05:00 committed by GitHub
commit 3b3d44f48c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 111 additions and 10 deletions

View file

@ -51,6 +51,24 @@ class TestGatewayPidState:
assert status.get_running_pid() is None
assert not pid_path.exists()
def test_get_running_pid_removes_stale_json_pid_file(self, tmp_path, monkeypatch):
monkeypatch.setenv("HERMES_HOME", str(tmp_path))
pid_path = tmp_path / "gateway.pid"
pid_path.write_text(json.dumps({
"pid": 99999,
"kind": "hermes-gateway",
"argv": ["python", "-m", "hermes_cli.main", "gateway"],
"start_time": None,
}))
def _raise_missing(pid, sig):
raise ProcessLookupError
monkeypatch.setattr(status.os, "kill", _raise_missing)
assert status.get_running_pid() is None
assert not pid_path.exists()
def test_get_running_pid_accepts_gateway_metadata_when_cmdline_unavailable(self, tmp_path, monkeypatch):
monkeypatch.setenv("HERMES_HOME", str(tmp_path))
pid_path = tmp_path / "gateway.pid"