mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-05-18 04:41:56 +00:00
test(gateway): stub /proc unavailability in find_gateway_pids fallback test
Follow-up test fix for #22693 — the existing test for ps-failure + pid-file fallback needed the /proc walk path stubbed too since /proc is now consulted first.
This commit is contained in:
parent
6bf7ac3185
commit
4ca7c2104d
1 changed files with 9 additions and 0 deletions
|
|
@ -419,6 +419,15 @@ def test_find_gateway_pids_falls_back_to_pid_file_when_process_scan_fails(monkey
|
|||
monkeypatch.setattr(gateway, "is_windows", lambda: False)
|
||||
monkeypatch.setattr("gateway.status.get_running_pid", lambda: 321)
|
||||
|
||||
# /proc walk is the first path tried (#22693). Force os.listdir on /proc
|
||||
# to raise so the function falls back to ps, where fake_run takes over.
|
||||
_real_listdir = gateway.os.listdir
|
||||
def _no_proc_listdir(path):
|
||||
if path == "/proc":
|
||||
raise OSError("test stub: /proc unavailable")
|
||||
return _real_listdir(path)
|
||||
monkeypatch.setattr(gateway.os, "listdir", _no_proc_listdir)
|
||||
|
||||
def fake_run(cmd, **kwargs):
|
||||
if cmd[:4] == ["ps", "-A", "eww", "-o"]:
|
||||
return SimpleNamespace(returncode=1, stdout="", stderr="ps failed")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue