test: fix flaky large raw-frame roundtrips (poll instead of fixed settle)#62
Open
pham-tuan-binh wants to merge 1 commit into
Open
test: fix flaky large raw-frame roundtrips (poll instead of fixed settle)#62pham-tuan-binh wants to merge 1 commit into
pham-tuan-binh wants to merge 1 commit into
Conversation
The large-raw-frame roundtrips (test_large_frame_above_data_packet_cap, test_4k_frame_roundtrip[raw]) flaked because they slept a fixed window then asserted the frame had arrived. A 25 MB raw frame takes ~4.6s over the byte-stream path, essentially equal to the 4.6s window, so under any load the assert raced the transfer and failed. The transfer itself is correct and byte-exact. Add a `wait_for` polling helper to conftest and use it in both tests: poll for arrival up to a generous ceiling (15s / 30s) instead of racing a fixed sleep. Returns as soon as the frame lands, so the fast path stays fast and only genuine failures wait out the timeout. Fixes #60
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.
Fixes #60.
Problem
Two frame-video integration tests flaked:
test_frame_video.py::test_large_frame_above_data_packet_cap(2.7 MB raw)test_frame_video_stress.py::test_4k_frame_roundtrip[raw](24.9 MB raw)They slept a fixed window then asserted the frame had arrived. Profiling showed a 25 MB raw frame takes ~4.6s over the byte-stream path, essentially equal to the test's 4.6s window. Under any load the assert raced the transfer and failed. The transfer itself is correct and byte-exact (the PNG/MJPEG variants, which compress small, always passed).
Fix
Test-only. Add a
wait_for(predicate, timeout_s)polling helper toconftest.pyand use it in both tests. Poll for arrival up to a generous ceiling (15s / 30s) instead of racing a fixed sleep. It returns as soon as the frame lands, so the fast path stays fast and only a genuine failure waits out the timeout.No production code changed. This is the transport-latency characteristic already documented for the byte-stream path, the tests just need to tolerate it.
Verification
Against a local LiveKit server:
Branched from
main, independent of #58 and #61.