test: stabilize signal resolved test#4773
Conversation
📝 WalkthroughWalkthroughThe test Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Possibly related PRs
Suggested labels
Suggested reviewers
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)
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.
Code Review
This pull request refactors a test in event_broker_test.go to decouple it from handshake logic and improve determinism by using a zero-value timestamp for rate limiting. The review feedback suggests using the setHandshaked() method instead of directly modifying the internal seq field to improve encapsulation and maintain consistency with other tests in the codebase.
| dispatcher.lastSentResolvedTsTime.Store(time.Now().Add(-defaultSendResolvedTsInterval - time.Second)) | ||
| // Keep the test focused on the signal resolved path instead of coupling it with | ||
| // the separate handshake behavior. | ||
| dispatcher.seq.Store(1) |
There was a problem hiding this comment.
Consider using the setHandshaked() method instead of directly storing a value in the unexported seq field. This is more idiomatic, ensures consistency with many other tests in this file (e.g., lines 172, 321, 400, 700), and provides better encapsulation of the dispatcher's handshake state.
| dispatcher.seq.Store(1) | |
| dispatcher.setHandshaked() |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: asddongmen The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
[LGTM Timeline notifier]Timeline:
|
What problem does this PR solve?
The table trigger signal resolved test is brittle because it validates two behaviors that are outside the scenario described by the test name:
HandshakeEventThat makes the test sensitive to benign changes in handshake timing or rate-limit related setup, even though the behavior under test is only the signal resolved path when there is no forward range and the dispatcher is not in the syncpoint commit stage.
Issue Number: close #4772
What is changed and how it works?
This PR narrows the test scope to the behavior it is supposed to verify.
lastSentResolvedTsTimeto zero time so the rate-limit bypass is deterministic instead of wall-clock basedCheck List
Tests
Questions
Will it cause performance regression or break compatibility?
No.
Do you need to update user documentation, design documentation or monitoring documentation?
No.
Release note
Summary by CodeRabbit