Answer every request in the lost-send test, not a fixed four

The server-error case queued four 503 responses. MockWebServer's queue
blocks a request that arrives after the queue is empty, so a send making
one request more than expected waits on the read timeout instead of
failing. The unit-tests job on MR 160 sat in :app:testReleaseUnitTest
for 29 minutes and was killed at the 30-minute limit; this is the one
test on the branch with a fixed-length queue. A dispatcher now answers
503 to every request.

The CI command, run locally with --rerun-tasks: app 711, engine 723,
client 480 (30 live skipped), obfs4 75, 0 failures, 2m 3s.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Paul Hitt
2026-10-09 06:48:45 -04:00
co-authored by Claude Opus 5.5
parent 5b3d194d65
commit cba942a64f
@@ -99,7 +99,12 @@ class ASendTheRelayNeverSawIsKeptTest {
@Test @Test
fun `a relay that answers with a server error`() { fun `a relay that answers with a server error`() {
val session = session() val session = session()
repeat(4) { server.enqueue(MockResponse().setResponseCode(503)) } // Every request, however many the send makes. A queue of a fixed
// number would block the client on the first request past its end.
server.dispatcher =
object : okhttp3.mockwebserver.Dispatcher() {
override fun dispatch(request: okhttp3.mockwebserver.RecordedRequest) = MockResponse().setResponseCode(503)
}
runCatching { session.send(peer, "try again later") } runCatching { session.send(peer, "try again later") }