test(kad): use virtual time to resolve flaky bootstrap test#6361
Open
0xsamalt wants to merge 5 commits intolibp2p:masterfrom
Open
test(kad): use virtual time to resolve flaky bootstrap test#63610xsamalt wants to merge 5 commits intolibp2p:masterfrom
0xsamalt wants to merge 5 commits intolibp2p:masterfrom
Conversation
Contributor
|
This pull request has merge conflicts. Could you please resolve them @0xsamalt? 🙏 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This PR fixes intermittent CPU-lag flakiness in Kademlia's bootstrap.rs test suite.
The tests previously measured real-world timeouts using
futures_timer::Delayandweb_time::Instant, causing them to fail when CI servers inevitably overshot expectations.By leveraging Tokio's
test-utilfeature and explicitly wrapping our mocks for the tests,#[tokio::test(start_paused = true)]ensures the elapsed test time is completely deterministic and decoupled from wall-clock performance. Tests run instantly and pass 100/100 times in local looping.cc @jxs @elenaf9
Notes & open questions
futures_timer::Delayis preserved under#[cfg(not(test))].Change checklist