[Kestrel] Deflake app abort test (#25484)
* [Kestrel] Deflake app abort test * better * fb
This commit is contained in:
parent
f7a76173e4
commit
83e31342a1
|
|
@ -2555,24 +2555,27 @@ namespace Microsoft.AspNetCore.Server.Kestrel.InMemory.FunctionalTests
|
|||
|
||||
[Fact]
|
||||
[QuarantinedTest("https://github.com/dotnet/aspnetcore/issues/24164")]
|
||||
[Repeat(100)]
|
||||
public async Task AppAbortViaIConnectionLifetimeFeatureIsLogged()
|
||||
{
|
||||
var testContext = new TestServiceContext(LoggerFactory);
|
||||
|
||||
await using (var server = new TestServer(httpContext =>
|
||||
var closeTaskTcs = new TaskCompletionSource<Task>(TaskCreationOptions.RunContinuationsAsynchronously);
|
||||
|
||||
await using (var server = new TestServer(async httpContext =>
|
||||
{
|
||||
var closeTask = await closeTaskTcs.Task.DefaultTimeout();
|
||||
var feature = httpContext.Features.Get<IConnectionLifetimeFeature>();
|
||||
feature.Abort();
|
||||
|
||||
// Ensure the response doesn't get flush before the abort is observed.
|
||||
var tcs = new TaskCompletionSource(TaskCreationOptions.RunContinuationsAsynchronously);
|
||||
feature.ConnectionClosed.Register(() => tcs.TrySetResult());
|
||||
|
||||
return tcs.Task;
|
||||
await closeTask;
|
||||
}, testContext))
|
||||
{
|
||||
using (var connection = server.CreateConnection())
|
||||
{
|
||||
closeTaskTcs.SetResult(connection.TransportConnection.WaitForCloseTask);
|
||||
|
||||
await connection.Send(
|
||||
"GET / HTTP/1.1",
|
||||
"Host:",
|
||||
|
|
|
|||
|
|
@ -131,6 +131,8 @@ namespace System.Buffers
|
|||
{
|
||||
SetAllBlocksReturned();
|
||||
}
|
||||
|
||||
_pool.Dispose();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue