-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
swarm: fix flaky TestBasicDialSync #1486
Conversation
Looks like this introduced some new flakiness, but I can't figure out why:
|
21b48d8
to
78bedcf
Compare
My guess is the small sleep between retries (1ms) is enough to stall progress on other goroutines. This example: https://gist.github.com/MarcoPolo/1bd2f7dcb103f2582043d00e342c1cb9 runs in 800ms on my machine when I use a 1ms sleep, but times out (>2s) when I use the smallest sleep. So maybe 1ms is too quick on the CI just like 1ns is too quick on my machine? |
p2p/net/swarm/dial_sync_test.go
Outdated
// make the dials return | ||
close(done) | ||
// make sure the Dial functions return | ||
require.Eventually(t, func() bool { return len(finished) == 2 }, 100*time.Millisecond, time.Millisecond, "dial functions should have returned") |
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.
It does seem like the receive from the channel avoids the notion of time which is nice.
95d74b5
to
1b61f0e
Compare
fc576d2
to
086f54d
Compare
9c49349
to
017a59a
Compare
017a59a
to
2a83f6d
Compare
5c49439
to
80d5814
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.
Lgtm modulo a nit.
p := peer.ID("testpeer") | ||
var counter int32 |
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.
make this a pointer
Haven't seen this test flaking in a while. I assume that @sukunrt's smart dialing changes have resolved the problem. |
Fixes #1430.