test(desktop): reproduce orphaned gateway on serve shutdown
This commit is contained in:
parent
07298df805
commit
eb9fc9ad7f
|
|
@ -1009,3 +1009,27 @@ def test_desktop_lifespan_reaps_orphan_gateways_on_startup(
|
|||
|
||||
assert called == [True]
|
||||
|
||||
|
||||
def test_desktop_lifespan_terminates_managed_gateway_restart(monkeypatch):
|
||||
"""A Desktop-owned gateway child must not survive its serve backend."""
|
||||
import hermes_cli.web_server as ws
|
||||
|
||||
calls = []
|
||||
|
||||
class _FakeRunningProc:
|
||||
def poll(self):
|
||||
return None
|
||||
|
||||
def terminate(self):
|
||||
calls.append("terminate")
|
||||
|
||||
monkeypatch.setenv("HERMES_DESKTOP", "1")
|
||||
monkeypatch.setattr(ws, "_warm_gateway_module", lambda: None)
|
||||
monkeypatch.setattr(ws, "_start_desktop_cron_ticker", lambda *_args: None)
|
||||
monkeypatch.setitem(ws._ACTION_PROCS, "gateway-restart", _FakeRunningProc())
|
||||
|
||||
client, _header = _client()
|
||||
with client:
|
||||
pass
|
||||
|
||||
assert calls == ["terminate"]
|
||||
|
|
|
|||
Loading…
Reference in New Issue