fix(engine): replace fixed sleeps with polling in backpressure tests#370
Merged
streamer45 merged 1 commit intomainfrom Apr 25, 2026
Merged
Conversation
The test_dynamic_connection_under_backpressure test used a fixed 100ms sleep before asserting the pacer node reached Running state. On slow CI runners the node lifecycle (Creating → Initializing → Running) takes longer than 100ms, causing sporadic assertion failures. Replace all fixed sleep + assert patterns across the three backpressure tests with a wait_for_states polling helper (same pattern used in the async_node_creation test suite). Each call polls get_node_states() every 20ms with a 5-second timeout, eliminating timing-dependent flakiness. Signed-off-by: StreamKit Devin <devin@streamkit.dev> Co-Authored-By: Claudio Costa <cstcld91@gmail.com>
Contributor
Author
|
✅ Reviewed on |
Contributor
Author
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
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
The
test_dynamic_connection_under_backpressuretest uses a fixed 100ms sleep before asserting the pacer node reachedRunningstate. On slow CI runners (e.g. this run) the node lifecycle (Creating → Initializing → Running) takes ~206ms, causing the assertion to fire before the node is ready.This PR replaces all fixed
sleep+ assert patterns across all three backpressure tests with await_for_statespolling helper — the same pattern already used in theasync_node_creationtest suite (crates/engine/src/tests/async_node_creation.rs:252). Each call pollsget_node_states()every 20ms with a 5-second timeout, eliminating timing-dependent flakiness.Changes:
wait_for_statespolling helper tobackpressure.rstest_backpressure_no_deadlock: replace 500ms sleep + two separate asserts with a single poll for bothreaderandpacerstatestest_dynamic_connection_under_backpressure: replace 100ms sleep + assert with poll forpacer=Runningtest_node_removal_under_backpressure: replace 100ms sleep with poll for pacer to leaveCreatingstate before removalReview & Testing Checklist for Human
wait_for_stateshelper matches the established pattern inasync_node_creation.rs(same poll interval, same signature)cargo test -p streamkit-engine --test backpressurelocally to confirm all 3 tests passNotes
The root cause was visible in the CI logs — the pacer's
Runningstate update arrived at11:53:31.158672Z, but the 100ms sleep (started aftersend_controlreturned at ~11:53:30.952Z) expired at ~11:53:31.052Z— about 107ms too early.Link to Devin session: https://staging.itsdev.in/sessions/8a81ffd549e742f8a209ff82586c27f6
Requested by: @streamer45