-
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
relaymanager: do not start new relay if one already exists #2093
Conversation
9c67ce1
to
4536b8e
Compare
4536b8e
to
e5442ec
Compare
p2p/host/relaysvc/relay_test.go
Outdated
func TestReachabilityChangeEvent(t *testing.T) { | ||
h := bhost.NewBlankHost(swarmt.GenSwarm(t)) | ||
rmgr := NewRelayManager(h) | ||
rmgr.reachabilityChanged(network.ReachabilityPublic) |
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.
I have a slight preference for not calling unexported functions in tests (where possible). In this case, you could get the event bus (via h.EventBus()
), and then emit reachability events.
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.
that's neat!
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.
this is fixed now
Co-authored-by: Marten Seemann <[email protected]>
p2p/host/relaysvc/relay_test.go
Outdated
require.Eventually( | ||
t, | ||
func() bool { rmgr.mutex.Lock(); defer rmgr.mutex.Unlock(); return rmgr.relay != nil }, | ||
200*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.
Better to increase this to a second, CI is super slow (sometimes), which then leads to flaky tests.
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.
fixed.
fixes: #2091