Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix flaky HTTP/2 test #41181

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1879,7 +1879,7 @@ await InitializeConnectionAsync(async context =>
{
requestAbortedTcs.SetException(ex);
}
}).DefaultTimeout();
halter73 marked this conversation as resolved.
Show resolved Hide resolved
});

await StartStreamAsync(1, _browserRequestHeaders, endStream: true).DefaultTimeout();

Expand Down Expand Up @@ -4725,7 +4725,6 @@ await ExpectAsync(Http2FrameType.DATA,
}

[Fact]
[QuarantinedTest("https://github.com/dotnet/aspnetcore/issues/41172")]
halter73 marked this conversation as resolved.
Show resolved Hide resolved
public async Task AcceptNewStreamsDuringClosingConnection()
{
await InitializeConnectionAsync(_echoApplication);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public async Task KeepAlivePingDelay_InfiniteTimeSpan_KeepAliveNotEnabled()
{
_serviceContext.ServerOptions.Limits.Http2.KeepAlivePingDelay = Timeout.InfiniteTimeSpan;

await InitializeConnectionAsync(_noopApplication).DefaultTimeout();
await InitializeConnectionAsync(_noopApplication);

Assert.Null(_connection._keepAlive);

Expand All @@ -26,7 +26,7 @@ public async Task KeepAlivePingTimeout_InfiniteTimeSpan_NoGoAway()
_serviceContext.ServerOptions.Limits.Http2.KeepAlivePingDelay = TimeSpan.FromSeconds(1);
_serviceContext.ServerOptions.Limits.Http2.KeepAlivePingTimeout = Timeout.InfiniteTimeSpan;

await InitializeConnectionAsync(_noopApplication).DefaultTimeout();
await InitializeConnectionAsync(_noopApplication);

DateTimeOffset now = _serviceContext.MockSystemClock.UtcNow;

Expand Down Expand Up @@ -56,7 +56,7 @@ public async Task IntervalExceeded_WithoutActivity_PingSent()
{
_serviceContext.ServerOptions.Limits.Http2.KeepAlivePingDelay = TimeSpan.FromSeconds(1);

await InitializeConnectionAsync(_noopApplication).DefaultTimeout();
await InitializeConnectionAsync(_noopApplication);

DateTimeOffset now = _serviceContext.MockSystemClock.UtcNow;

Expand All @@ -79,7 +79,7 @@ public async Task IntervalExceeded_WithActivity_NoPingSent()
{
_serviceContext.ServerOptions.Limits.Http2.KeepAlivePingDelay = TimeSpan.FromSeconds(1);

await InitializeConnectionAsync(_noopApplication).DefaultTimeout();
await InitializeConnectionAsync(_noopApplication);

DateTimeOffset now = _serviceContext.MockSystemClock.UtcNow;

Expand All @@ -103,7 +103,7 @@ public async Task IntervalNotExceeded_NoPingSent()
{
_serviceContext.ServerOptions.Limits.Http2.KeepAlivePingDelay = TimeSpan.FromSeconds(5);

await InitializeConnectionAsync(_noopApplication).DefaultTimeout();
await InitializeConnectionAsync(_noopApplication);

DateTimeOffset now = new DateTimeOffset(1, TimeSpan.Zero);

Expand All @@ -121,7 +121,7 @@ public async Task IntervalExceeded_MultipleTimes_PingsNotSentWhileAwaitingOnAck(
{
_serviceContext.ServerOptions.Limits.Http2.KeepAlivePingDelay = TimeSpan.FromSeconds(1);

await InitializeConnectionAsync(_noopApplication).DefaultTimeout();
await InitializeConnectionAsync(_noopApplication);

DateTimeOffset now = _serviceContext.MockSystemClock.UtcNow;

Expand All @@ -145,7 +145,7 @@ public async Task IntervalExceeded_MultipleTimes_PingSentAfterAck()
{
_serviceContext.ServerOptions.Limits.Http2.KeepAlivePingDelay = TimeSpan.FromSeconds(1);

await InitializeConnectionAsync(_noopApplication).DefaultTimeout();
await InitializeConnectionAsync(_noopApplication);

DateTimeOffset now = _serviceContext.MockSystemClock.UtcNow;

Expand Down Expand Up @@ -185,7 +185,7 @@ public async Task TimeoutExceeded_NoAck_GoAway()
_serviceContext.ServerOptions.Limits.Http2.KeepAlivePingDelay = TimeSpan.FromSeconds(1);
_serviceContext.ServerOptions.Limits.Http2.KeepAlivePingTimeout = TimeSpan.FromSeconds(3);

await InitializeConnectionAsync(_noopApplication).DefaultTimeout();
await InitializeConnectionAsync(_noopApplication);

DateTimeOffset now = _serviceContext.MockSystemClock.UtcNow;

Expand Down Expand Up @@ -217,7 +217,7 @@ public async Task TimeoutExceeded_NonPingActivity_NoGoAway()
_serviceContext.ServerOptions.Limits.Http2.KeepAlivePingDelay = TimeSpan.FromSeconds(1);
_serviceContext.ServerOptions.Limits.Http2.KeepAlivePingTimeout = TimeSpan.FromSeconds(3);

await InitializeConnectionAsync(_noopApplication).DefaultTimeout();
await InitializeConnectionAsync(_noopApplication);

DateTimeOffset now = _serviceContext.MockSystemClock.UtcNow;

Expand Down Expand Up @@ -249,7 +249,7 @@ public async Task IntervalExceeded_StreamStarted_NoPingSent()
{
_serviceContext.ServerOptions.Limits.Http2.KeepAlivePingDelay = TimeSpan.FromSeconds(1);

await InitializeConnectionAsync(_noopApplication).DefaultTimeout();
await InitializeConnectionAsync(_noopApplication);

DateTimeOffset now = _serviceContext.MockSystemClock.UtcNow;

Expand Down Expand Up @@ -284,7 +284,7 @@ await InitializeConnectionAsync(async c =>
await tcs.Task;
// Send headers
await c.Request.Body.FlushAsync();
}, expectedWindowUpdate: false).DefaultTimeout();
}, expectedWindowUpdate: false);

DateTimeOffset now = _serviceContext.MockSystemClock.UtcNow;

Expand Down Expand Up @@ -339,7 +339,7 @@ await InitializeConnectionAsync(async c =>
await tcs.Task;
// Send headers
await c.Request.Body.FlushAsync();
}, expectedWindowUpdate: false).DefaultTimeout();
}, expectedWindowUpdate: false);

DateTimeOffset now = _serviceContext.MockSystemClock.UtcNow;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2562,7 +2562,7 @@ await InitializeConnectionAsync(async context =>
context.Response.BodyWriter.Advance(windowSize + 1);

context.Response.AppendTrailer("CustomName", "Custom Value");
}).DefaultTimeout();
});

await StartStreamAsync(1, headers, endStream: true).DefaultTimeout();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
using System.Net.Http;
using System.Net.Http.HPack;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Text;
using Microsoft.AspNetCore.Connections;
using Microsoft.AspNetCore.Http;
Expand Down Expand Up @@ -495,7 +496,10 @@ async Task CompletePipeOnTaskCompletion()
_connectionTask = CompletePipeOnTaskCompletion();
}

protected async Task InitializeConnectionAsync(RequestDelegate application, int expectedSettingsCount = 3, bool expectedWindowUpdate = true)
protected ConfiguredTaskAwaitable InitializeConnectionAsync(RequestDelegate application, int expectedSettingsCount = 3, bool expectedWindowUpdate = true) =>
InitializeConnectionAsyncCore(application, expectedSettingsCount, expectedWindowUpdate).ConfigureAwait(false);

protected async Task InitializeConnectionAsyncCore(RequestDelegate application, int expectedSettingsCount, bool expectedWindowUpdate)
{
InitializeConnectionWithoutPreface(application);

Expand Down