Skip to content

Commit

Permalink
Merge pull request #1191 from libp2p/fix-flaky-end-to-end-sim-connect…
Browse files Browse the repository at this point in the history
…-test

fix flaky TestEndToEndSimConnect holepunching test
  • Loading branch information
marten-seemann authored Sep 25, 2021
2 parents 22b62cf + af24f73 commit eba91ac
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions p2p/protocol/holepunch/coordination_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,15 @@ func TestEndToEndSimConnect(t *testing.T) {
ensureDirectConn(t, h1, h2)
// ensure no hole-punching streams are open on either side
ensureNoHolePunchingStream(t, h1, h2)
events := tr.getEvents()
require.Len(t, events, 3)
var events []*holepunch.Event
require.Eventually(t,
func() bool {
events = tr.getEvents()
return len(events) == 3
},
time.Second,
10*time.Millisecond,
)
require.Equal(t, events[0].Type, holepunch.StartHolePunchEvtT)
require.Equal(t, events[1].Type, holepunch.HolePunchAttemptEvtT)
require.Equal(t, events[2].Type, holepunch.EndHolePunchEvtT)
Expand Down

0 comments on commit eba91ac

Please sign in to comment.