Skip to content

Commit

Permalink
quic: fix flaky TestResourceManagerAcceptDenied (#1485)
Browse files Browse the repository at this point in the history
  • Loading branch information
marten-seemann authored May 15, 2022
1 parent 69b6d95 commit 1d64bc1
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions p2p/transport/quic/conn_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -197,11 +197,12 @@ func TestResourceManagerAcceptDenied(t *testing.T) {
clientConnScope := mocknetwork.NewMockConnManagementScope(ctrl)
clientRcmgr.EXPECT().OpenConnection(network.DirOutbound, false).Return(clientConnScope, nil)
clientConnScope.EXPECT().SetPeer(serverID)
// In rare instances, the connection gating error will already occur on Dial.
// In that case, Done is called on the connection scope.
clientConnScope.EXPECT().Done().MaxTimes(1)
conn, err := clientTransport.Dial(context.Background(), ln.Multiaddr(), serverID)
// In rare instances, the connection gating error will already occur on Dial.
if err != nil {
clientConnScope.EXPECT().Done()
} else {
if err == nil {
_, err = conn.AcceptStream()
require.Error(t, err)
}
Expand Down

0 comments on commit 1d64bc1

Please sign in to comment.