Skip to content

Migrate tests to simlibp2p + synctest#686

Open
MarcoPolo wants to merge 1 commit intomasterfrom
migrate-simlibp2p
Open

Migrate tests to simlibp2p + synctest#686
MarcoPolo wants to merge 1 commit intomasterfrom
migrate-simlibp2p

Conversation

@MarcoPolo
Copy link
Copy Markdown
Contributor

Highly recommend ignoring whitespace changes. ?w=1 parameter in the github UI.

This removes flakiness from the tests, and makes the tests run much much faster. On my machine tests now finish in 30s (previously took: 380s; 10x faster)


Replace real libp2p hosts with simulated in-memory network (simlibp2p) and wrap all ~200 tests in Go 1.25's synctest.Test for deterministic time. This eliminates flakiness and speeds up the test suite.

Production code change: make GossipSub heartbeatTimer respect context cancellation during initial delay.

Tests migrated by Claude Opus 4.6

@MarcoPolo MarcoPolo requested a review from sukunrt March 17, 2026 22:21
Replace real libp2p hosts with simulated in-memory network
(simlibp2p) and wrap all ~200 tests in Go 1.25's synctest.Test
for deterministic time. This eliminates flakiness and speeds up
the test suite.

Production code change: make GossipSub heartbeatTimer respect
context cancellation during initial delay.

Tests migrated by Claude Opus 4.6
@laciferin2024
Copy link
Copy Markdown
Contributor

WoW, recently it took 17m on the CI, i guess it should take a fraction of the time now . Amazing 🤩.

@MarcoPolo Since the testing/synctest was experimental until recently, i think its important to update the contribution doc to specify how tests should be written moving forward.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants