Skip to content

Commit

Permalink
quic: fix flaky TestConnectionGating test
Browse files Browse the repository at this point in the history
  • Loading branch information
marten-seemann committed Apr 22, 2022
1 parent 5151d4b commit dafc4fa
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions p2p/transport/quic/conn_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -303,9 +303,11 @@ func TestConnectionGating(t *testing.T) {
defer clientTransport.(io.Closer).Close()
// make sure that connection attempts fails
conn, err := clientTransport.Dial(context.Background(), ln.Multiaddr(), serverID)
require.NoError(t, err)
_, err = conn.AcceptStream()
require.Error(t, err)
// In rare instances, the connection gating error will already occur on Dial.
// In most cases, it will be returned by AcceptStream.
if err == nil {
_, err = conn.AcceptStream()
}
require.Contains(t, err.Error(), "connection gated")

// now allow the address and make sure the connection goes through
Expand Down

0 comments on commit dafc4fa

Please sign in to comment.