Skip to content

Commit

Permalink
quic: deflake the holepunching test (#1484)
Browse files Browse the repository at this point in the history
  • Loading branch information
marten-seemann authored May 15, 2022
1 parent f383f46 commit 69b6d95
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion p2p/transport/quic/conn_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -550,7 +550,13 @@ func TestHolePunching(t *testing.T) {
// Make sure the server role (the dial on t2) has progressed far enough.
// If it hasn't created the hole punch map entry, the connection will be accepted as a regular connection,
// which would make this test fail.
time.Sleep(25 * time.Millisecond)
require.Eventually(t, func() bool {
tr := t2.(*transport)
tr.holePunchingMx.Lock()
defer tr.holePunchingMx.Unlock()
return len(tr.holePunching) > 0
}, time.Second, 10*time.Millisecond)

conn1, err := t1.Dial(
network.WithSimultaneousConnect(context.Background(), true, ""),
ln2.Multiaddr(),
Expand Down

0 comments on commit 69b6d95

Please sign in to comment.