test(router): give the C3 backup stream gate the same timeout as its request wait

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
This commit is contained in:
kerry 2026-10-01 22:43:52 +00:00
parent 51c74cc112
commit dc0a2280fe
2 changed files with 5 additions and 1 deletions

View file

@ -28,6 +28,7 @@ class Reply:
chunks: tuple[bytes, ...] | None = None
abort_after: int | None = None
gate_after_first: threading.Event | None = None
gate_timeout_seconds: float = 5.0
pause_between_chunks: float = 0
headers: Mapping[str, str] = MappingProxyType({})
@ -104,7 +105,9 @@ def wire_server(
self.wfile.write(b"%x\r\n%s\r\n" % (len(chunk), chunk))
self.wfile.flush()
if index == 0 and reply.gate_after_first is not None:
assert reply.gate_after_first.wait(timeout=5), "Stream barrier was never released"
assert reply.gate_after_first.wait(timeout=reply.gate_timeout_seconds), (
"Stream barrier was never released"
)
if reply.pause_between_chunks and index + 1 < len(reply.chunks):
time.sleep(reply.pause_between_chunks)
else:

View file

@ -1394,6 +1394,7 @@ def test_c3_surviving_proxy_worker_serves_after_one_worker_is_killed(gateway: Ga
content_type="text/event-stream",
chunks=_chat_chunks(_request_identity(request_body)),
gate_after_first=backup_gate,
gate_timeout_seconds=60,
)
with (