test: fix flaky test TestSendRequestAsyncAndCloseClientOnHandle#1889
test: fix flaky test TestSendRequestAsyncAndCloseClientOnHandle#1889lance6716 wants to merge 1 commit intotikv:masterfrom
Conversation
Signed-off-by: lance6716 <lance6716@gmail.com>
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
📝 WalkthroughWalkthroughThis change fixes a flaky test by introducing synchronization mechanisms to eliminate race conditions. A Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
No actionable comments were generated in the recent review. 🎉 Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Pull request overview
Stabilizes the flaky TestSendRequestAsyncAndCloseClientOnHandle by making the test deterministically wait until the mock server has actually received the async batch request before closing the RPC client, matching the scenario the test intends to validate.
Changes:
- Replace timing-based
time.Sleep/time.AfterFuncsequencing with an explicit “handler entered” signal from the mock server. - Block the mock handler on a cancellable context so the test can precisely control when the server-side handler is allowed to finish.
- Add bounded waits/timeouts around both “request reached server” and runloop execution to avoid hanging.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
close #1887
fixed by codex
Summary by CodeRabbit