mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-05-07 02:51:50 +00:00
fix(tests): tolerate ps ancestor-walk in find_gateway_pids fallback test (#19590)
Follow-up to #19586 (@cixuuz salvage): _get_ancestor_pids walks ps -o ppid= up the process tree, which the pre-existing mock in test_find_gateway_pids_falls_back_to_pid_file_when_process_scan_fails didn't expect. Return empty stdout so the ancestor loop terminates cleanly and the original fallback assertion still passes.
This commit is contained in:
parent
9c93fc5775
commit
06031229e8
1 changed files with 4 additions and 0 deletions
|
|
@ -310,6 +310,10 @@ def test_find_gateway_pids_falls_back_to_pid_file_when_process_scan_fails(monkey
|
||||||
def fake_run(cmd, **kwargs):
|
def fake_run(cmd, **kwargs):
|
||||||
if cmd[:4] == ["ps", "-A", "eww", "-o"]:
|
if cmd[:4] == ["ps", "-A", "eww", "-o"]:
|
||||||
return SimpleNamespace(returncode=1, stdout="", stderr="ps failed")
|
return SimpleNamespace(returncode=1, stdout="", stderr="ps failed")
|
||||||
|
if cmd[:3] == ["ps", "-o", "ppid="]:
|
||||||
|
# _get_ancestor_pids() walks up the tree; return "no parent" so
|
||||||
|
# the loop terminates cleanly.
|
||||||
|
return SimpleNamespace(returncode=1, stdout="", stderr="")
|
||||||
raise AssertionError(f"Unexpected command: {cmd}")
|
raise AssertionError(f"Unexpected command: {cmd}")
|
||||||
|
|
||||||
monkeypatch.setattr(gateway.subprocess, "run", fake_run)
|
monkeypatch.setattr(gateway.subprocess, "run", fake_run)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue