-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Merging to release-5.3.9: Fixing Race Condition in CI (#6761) #6763
Merging to release-5.3.9: Fixing Race Condition in CI (#6761) #6763
Conversation
### **User description** Fixing a unit test with a race condition that was already fixed in `master` branch. ___ ### **PR Type** Bug fix, Tests ___ ### **Description** - Fixed a race condition in the `TestStartPubSubHandler` unit test by replacing a boolean flag with a buffered channel to track callback invocation. - Introduced a timeout mechanism using `context.WithTimeout` to ensure the callback is executed within a specific time frame. - Removed arbitrary sleep and replaced it with a deterministic approach using `select` and context for better test reliability. - Improved the overall robustness and reliability of the test. ___ ### **Changes walkthrough** 📝 <table><thead><tr><th></th><th align="left">Relevant files</th></tr></thead><tbody><tr><td><strong>Bug fix</strong></td><td><table> <tr> <td> <details> <summary><strong>redis_cluster_test.go</strong><dd><code>Fix race condition in PubSub handler test</code> </dd></summary> <hr> storage/redis_cluster_test.go <li>Replaced a boolean flag with a buffered channel to track callback <br>invocation.<br> <li> Added a timeout mechanism using <code>context.WithTimeout</code> to ensure callback <br>execution is verified within a specific time.<br> <li> Removed arbitrary sleep and replaced it with a more deterministic <br>approach using <code>select</code> and context.<br> <li> Improved test reliability by ensuring callback execution is properly <br>awaited.<br> </details> </td> <td><a href="https://github.com/TykTechnologies/tyk/pull/6761/files#diff-6881545acab41fff3221454e0efb16302c696ea1217da926f80332a62ef51c71">+12/-4</a> </td> </tr> </table></td></tr></tr></tbody></table> ___ > 💡 **PR-Agent usage**: Comment `/help "your question"` on any pull request to receive relevant information (cherry picked from commit 4e7a120)
API Changes no api changes detected |
PR Reviewer Guide 🔍Here are some key observations to aid the review process:
|
PR Code Suggestions ✨Explore these optional code suggestions:
|
Quality Gate passedIssues Measures |
User description
Fixing Race Condition in CI (#6761)
User description
Fixing a unit test with a race condition that was already fixed in
master
branch.PR Type
Bug fix, Tests
Description
TestStartPubSubHandler
unit test byreplacing a boolean flag with a buffered channel to track callback
invocation.
context.WithTimeout
to ensurethe callback is executed within a specific time frame.
using
select
and context for better test reliability.Changes walkthrough 📝
redis_cluster_test.go
Fix race condition in PubSub handler test
storage/redis_cluster_test.go
invocation.
context.WithTimeout
to ensure callbackexecution is verified within a specific time.
approach using
select
and context.awaited.
PR Type
Bug fix, Tests
Description
TestStartPubSubHandler
unit test by replacing a boolean flag with a buffered channel to track callback invocation.context.WithTimeout
to ensure the callback is executed within a specific time frame.select
and context for better test reliability.Changes walkthrough 📝
redis_cluster_test.go
Fix race condition in PubSub handler test
storage/redis_cluster_test.go
invocation.
context.WithTimeout
to ensurecallback execution is verified within a specific time.
using
select
and context.awaited.