-
Notifications
You must be signed in to change notification settings - Fork 490
exporter: fix flaky Test_rateLimitExport with polling #4280
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Replace fixed sleep with polling-based synchronization to eliminate timing-dependent race condition that caused intermittent test failures. The test was using a fixed 200ms sleep which created a window where multiple ticker intervals could fire, causing off-by-one errors in event counts. The new approach polls every 10ms until expected events are received, with a 500ms timeout for robustness. Fixes cilium#2789 Signed-off-by: Farooq Shaikh <[email protected]>
299f80b to
57d5e47
Compare
|
This PR fixes a flaky test with no user-facing changes. Could a maintainer please add the |
FedeDP
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks!
mtardy
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm as well, only a few golang nits. Will merge this later, give you some time to update the patch or not depending on what you prefer! thanks
Co-authored-by: Mahé <[email protected]> Signed-off-by: Farooq Shaikh <[email protected]>
Co-authored-by: Mahé <[email protected]> Signed-off-by: Farooq Shaikh <[email protected]>
✅ Deploy Preview for tetragon ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
✅ Deploy Preview for tetragon ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
Sorry for the late reply. Was on vacation. Have incorporated your suggestions 🙂 |
Summary
This PR fixes the flaky Test_rateLimitExport test by replacing the fixed sleep duration with a polling-based synchronization mechanism, addressing the timing race condition reported in #2789.
Related Issue
Fixes #2789
Root Cause
The test used a fixed 200ms sleep which allowed multiple rate limiter ticker intervals (50ms each) to fire during the wait period. This created a timing window where:
Proposed Changes
Testing Performed
Backward Compatibility
No breaking changes. The fix only modifies the test implementation, not the rate limiter functionality itself.
Changelog