Skip to content

Commit

Permalink
swarm: fix flaky and racy TestDialExistingConnection (#1491)
Browse files Browse the repository at this point in the history
  • Loading branch information
marten-seemann authored May 16, 2022
1 parent a66dd00 commit fee2581
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion p2p/net/swarm/dial_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -487,7 +487,10 @@ func TestDialExistingConnection(t *testing.T) {
c2, err := s1.DialPeer(context.Background(), s2.LocalPeer())
require.NoError(t, err)

require.Equal(t, c1, c2, "expecting the same connection from both dials")
// can't use require.Equal here, as this does a deep comparison
if c1 != c2 {
t.Fatal("expecting the same connection from both dials")
}
}

func newSilentListener(t *testing.T) ([]ma.Multiaddr, net.Listener) {
Expand Down

0 comments on commit fee2581

Please sign in to comment.