-
Notifications
You must be signed in to change notification settings - Fork 379
test(kademlia): Add synctest to TestAddressBookQuickPrune and remove … #5274
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: master
Are you sure you want to change the base?
Conversation
634753a to
119231f
Compare
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.
Pull Request Overview
This PR refactors a flaky test by leveraging Go's testing/synctest package to provide deterministic execution for time-dependent test logic, removing the "_FLAKY" suffix from the test name.
- Wraps
TestAddressBookQuickPrune(previouslyTestAddressBookQuickPrune_FLAKY) withsynctest.Testfor deterministic time handling - Removes
t.Parallel()call (incompatible withsynctest.Test) - Adds
testing/synctestimport to support the new testing approach
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| testutil.CleanupCloser(t, kad) | ||
|
|
||
| time.Sleep(100 * time.Millisecond) | ||
| time.Sleep(100 * time.Millisecond) |
Copilot
AI
Oct 31, 2025
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.
When using synctest.Test, real time.Sleep calls should typically be avoided as they defeat the purpose of deterministic time simulation. Consider removing this sleep or verifying if it's necessary with synctest's time control mechanisms.
| time.Sleep(100 * time.Millisecond) | |
| synctest.Advance(t, 100 * time.Millisecond) |
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.
There is no synctest.Advance in the docs 🙂
martinconic
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.
Please take a look at failing tests
Checklist
Description
Open API Spec Version Changes (if applicable)
Motivation and Context (Optional)
Related Issue (Optional)
Screenshots (if appropriate):