Skip to content

Commit

Permalink
Add timeouts to QuicConnectionTests for StreamsAvailable tests (dotne…
Browse files Browse the repository at this point in the history
  • Loading branch information
rzikm authored Jul 31, 2024
1 parent bffe34e commit fd2b245
Showing 1 changed file with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ public async Task GetStreamCapacity_OpenCloseStream_CountsCorrectly()
};

(QuicConnection clientConnection, QuicConnection serverConnection) = await CreateConnectedQuicConnection(clientOptions);
await streamsAvailableFired.WaitAsync();
await streamsAvailableFired.WaitAsync().WaitAsync(PassingTestTimeout);
Assert.Equal(QuicDefaults.DefaultServerMaxInboundBidirectionalStreams, bidiIncrement);
Assert.Equal(QuicDefaults.DefaultServerMaxInboundUnidirectionalStreams, unidiIncrement);

Expand All @@ -275,7 +275,7 @@ public async Task GetStreamCapacity_OpenCloseStream_CountsCorrectly()
await serverStreamBidi.DisposeAsync();

// STREAMS_AVAILABLE event comes asynchronously, give it a chance to propagate
await streamsAvailableFired.WaitAsync();
await streamsAvailableFired.WaitAsync().WaitAsync(PassingTestTimeout);
Assert.Equal(1, bidiIncrement);
Assert.Equal(0, unidiIncrement);

Expand All @@ -285,7 +285,7 @@ public async Task GetStreamCapacity_OpenCloseStream_CountsCorrectly()
await serverStreamUnidi.DisposeAsync();

// STREAMS_AVAILABLE event comes asynchronously, give it a chance to propagate
await streamsAvailableFired.WaitAsync();
await streamsAvailableFired.WaitAsync().WaitAsync(PassingTestTimeout);
Assert.Equal(0, bidiIncrement);
Assert.Equal(1, unidiIncrement);

Expand Down Expand Up @@ -314,7 +314,7 @@ public async Task GetStreamCapacity_OpenCloseStreamIntoNegative_CountsCorrectly(
};

(QuicConnection clientConnection, QuicConnection serverConnection) = await CreateConnectedQuicConnection(clientOptions);
await streamsAvailableFired.WaitAsync();
await streamsAvailableFired.WaitAsync().WaitAsync(PassingTestTimeout);
Assert.Equal(QuicDefaults.DefaultServerMaxInboundBidirectionalStreams, bidiIncrement);
Assert.Equal(QuicDefaults.DefaultServerMaxInboundUnidirectionalStreams, unidiIncrement);
Assert.Equal(QuicDefaults.DefaultServerMaxInboundBidirectionalStreams, bidiTotal);
Expand Down Expand Up @@ -353,7 +353,7 @@ public async Task GetStreamCapacity_OpenCloseStreamIntoNegative_CountsCorrectly(
{
await clientStream.DisposeAsync();
await (await serverConnection.AcceptInboundStreamAsync()).DisposeAsync();
await streamsAvailableFired.WaitAsync();
await streamsAvailableFired.WaitAsync().WaitAsync(PassingTestTimeout);
Assert.Equal(unidirectional ? 0 : (first ? QuicDefaults.DefaultServerMaxInboundBidirectionalStreams + 1 : 1), bidiIncrement);
Assert.Equal(unidirectional ? (first ? QuicDefaults.DefaultServerMaxInboundUnidirectionalStreams + 1 : 1) : 0, unidiIncrement);
first = false;
Expand Down Expand Up @@ -387,7 +387,7 @@ public async Task GetStreamCapacity_OpenCloseStreamCanceledIntoNegative_CountsCo
};

(QuicConnection clientConnection, QuicConnection serverConnection) = await CreateConnectedQuicConnection(clientOptions);
await streamsAvailableFired.WaitAsync();
await streamsAvailableFired.WaitAsync().WaitAsync(PassingTestTimeout);
Assert.Equal(QuicDefaults.DefaultServerMaxInboundBidirectionalStreams, bidiIncrement);
Assert.Equal(QuicDefaults.DefaultServerMaxInboundUnidirectionalStreams, unidiIncrement);
Assert.Equal(QuicDefaults.DefaultServerMaxInboundBidirectionalStreams, bidiTotal);
Expand Down Expand Up @@ -426,7 +426,7 @@ public async Task GetStreamCapacity_OpenCloseStreamCanceledIntoNegative_CountsCo
{
Assert.True(cancelledStream.IsCanceled);
await (await serverConnection.AcceptInboundStreamAsync()).DisposeAsync();
await streamsAvailableFired.WaitAsync();
await streamsAvailableFired.WaitAsync().WaitAsync(PassingTestTimeout);
Assert.Equal(unidirectional ? 0 : (first ? QuicDefaults.DefaultServerMaxInboundBidirectionalStreams + 1 : 1), bidiIncrement);
Assert.Equal(unidirectional ? (first ? QuicDefaults.DefaultServerMaxInboundUnidirectionalStreams + 1 : 1) : 0, unidiIncrement);
first = false;
Expand Down

0 comments on commit fd2b245

Please sign in to comment.