mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-07-01 12:02:05 +00:00
test(web_server): assert ws-ping invariant, not frozen 20.0 literal
The loopback ws-ping window is now 30s/60s (#48445/#50005), so the hardcoded == 20.0 assertion was a change-detector that broke the moment the loopback tuning landed. Assert the behavioral contract instead: ping stays enabled (positive) and timeout >= interval.
This commit is contained in:
parent
db880186f2
commit
eeb4735078
1 changed files with 10 additions and 3 deletions
|
|
@ -71,14 +71,21 @@ def _stub_uvicorn(monkeypatch):
|
|||
|
||||
def test_start_server_enables_ws_ping_for_half_open_detection(monkeypatch):
|
||||
"""WS ping must be configured so half-open connections (reverse-proxy 524,
|
||||
dropped tunnels) raise WebSocketDisconnect into the reaping path (#32377)."""
|
||||
dropped tunnels) raise WebSocketDisconnect into the reaping path (#32377).
|
||||
|
||||
Loopback binds (the Desktop case) get a longer window to ride out
|
||||
GIL-pressure event-loop stalls (#48445/#50005). The invariant asserted
|
||||
here is that ping stays enabled (non-None, positive) and the timeout is
|
||||
never shorter than the interval — not a frozen literal, which churns every
|
||||
time the window is retuned."""
|
||||
captured = _stub_uvicorn(monkeypatch)
|
||||
|
||||
# Loopback bind => no auth gate, so this reaches the Config constructor.
|
||||
web_server.start_server(host="127.0.0.1", port=0, open_browser=False)
|
||||
|
||||
assert captured["ws_ping_interval"] == 20.0
|
||||
assert captured["ws_ping_timeout"] == 20.0
|
||||
assert captured["ws_ping_interval"] and captured["ws_ping_interval"] > 0
|
||||
assert captured["ws_ping_timeout"] and captured["ws_ping_timeout"] > 0
|
||||
assert captured["ws_ping_timeout"] >= captured["ws_ping_interval"]
|
||||
|
||||
|
||||
def test_start_server_runs_on_uvicorns_loop_factory(monkeypatch):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue