fix(test): replace flaky 1ms sleep with polling in engine test#5306
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
This PR improves the reliability of TestEngine_ConsumeSources in the signatures engine by replacing a brittle fixed 1ms sleep with polling-based synchronization to reduce intermittent CI failures under load.
Changes:
- Replaces the 1ms propagation sleep with
require.Eventuallypolling for positive event-delivery cases. - Adds a short delay for zero-event cases before asserting no events were received.
The TestEngine_ConsumeSources test relied on a 1ms sleep for event propagation, causing intermittent failures on loaded x86_64 runners when the engine goroutine hadn't processed the event in time. Use require.Eventually (5s timeout, 10ms poll) with exact count matching for positive-event cases, and require.Never over a 50ms window for zero-event assertions. Remove dead gotEvent/emptyEvent comparison that always passed regardless of behavior.
josedonizetti
approved these changes
May 19, 2026
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.
1. Explain what the PR does
022cbe8 fix(test): replace flaky 1ms sleep with polling in engine test
--
2. Explain how to test it
3. Other comments