Repository navigation
test(live): answer the close frame so the mock server shuts down on time - #10
Merged
Merged
Conversation
The mock WebSocket server never answered the client's close frame, so the server side of the socket kept its read loop alive and MockWebServer.shutdown() sometimes gave up after five seconds ('Gave up waiting for queue to shut down'), failing a LiveConnectionTest at teardown. Answering onClosing completes the close handshake.
This branch was previously deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
LiveConnectionTestfails at teardown on some runs:It failed on the CI run of
mainafter #8 was merged (onauthenticatedSessionRefreshesJwtBeforeMintingWebSocketToken, which then also took 5 s), and once in a full local run. The tag build runs the same job, so a tag can fail this way too.Cause
The mock WebSocket server never answered the client's close frame (
WebSocketListener.onClosingwas not overridden). The server side of each socket keeps its read loop alive until the client gives up, andMockWebServer.shutdown()waits only five seconds for that queue to drain.Fix
Answer
onClosingwithsocket.close(code, reason), completing the close handshake. Test code only.Checked
On an 8-core machine with 16 busy loops competing for the CPU,
LiveConnectionTestrun 10 times in a row:Without the load, the test passed 15 of 15 in isolation and 8 of 8 in the full suite before the change, so it is a timing race that shows up on a busy or slow runner. The full suite passes with the change.