Skip to content
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

Fix flaky TestIdentifyPushOnAddrChange #952

Merged
merged 1 commit into from
May 21, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions p2p/protocol/identify/id_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -587,11 +587,13 @@ func TestIdentifyPushOnAddrChange(t *testing.T) {

h2pi := h2.Peerstore().PeerInfo(h2p)
require.NoError(t, h1.Connect(ctx, h2pi))
// h1 should immediately see a connection from h2
require.Len(t, h1.Network().ConnsToPeer(h2p), 1)
require.Len(t, h2.Network().ConnsToPeer(h1p), 1)

// wait for identify to complete and assert current addresses
// wait for h2 to Identify itself so we are sure h2 has seen the connection.
ids1.IdentifyConn(h1.Network().ConnsToPeer(h2p)[0])

// h2 should now see the connection and we should wait for h1 to Identify itself to h2.
require.Len(t, h2.Network().ConnsToPeer(h1p), 1)
ids2.IdentifyConn(h2.Network().ConnsToPeer(h1p)[0])

testKnowsAddrs(t, h1, h2p, h2.Peerstore().Addrs(h2p))
Expand Down