test(web-server): deflake pub event broadcast coverage#37359
Open
hanzckernel wants to merge 2 commits into
Open
test(web-server): deflake pub event broadcast coverage#37359hanzckernel wants to merge 2 commits into
hanzckernel wants to merge 2 commits into
Conversation
…st-main # Conflicts: # tests/hermes_cli/test_web_server.py
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.
Summary
/api/pubforwards publisher frames to_broadcast_event_broadcast_eventfans out a frame to all registered channel subscribersWhy
The old test opened
/api/eventsand/api/pubwebsockets at the same time through Starlette'sTestClient, then waited for the subscriber client to receive the forwarded frame. Under load this can time out even though the production split points are simple:/api/pubreceives a frame and calls_broadcast_event, while_broadcast_eventsends the payload to each registered subscriber.The replacement keeps those two behavior contracts covered without depending on a racy multi-websocket TestClient receive path.
Scope
Changed file:
tests/hermes_cli/test_web_server.pyNo production code changes.
Verification
/api/pubforwarding test: passed 30 repeated runs_broadcast_eventfanout test: passed 30 repeated runspython -m pytest tests/hermes_cli/test_web_server.py::TestPtyWebSocket -q -o 'addopts='python -m py_compile tests/hermes_cli/test_web_server.pygit diff --checkRelated
Related to the failing
test (2)CI shard observed on #37350.