Skip to content

Commit 15927ed

Browse files
JamesNKcaptainsafia
authored andcommitted
Quarantine Http1Connection_ServerAbort_HasErrorType (#58087)
1 parent df76545 commit 15927ed

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

src/Servers/Kestrel/test/InMemory.FunctionalTests/KestrelMetricsTests.cs

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -391,6 +391,7 @@ await connection.ReceiveEnd(
391391
}
392392

393393
[Fact]
394+
[QuarantinedTest("https://github.com/dotnet/aspnetcore/issues/58086")]
394395
public async Task Http1Connection_ServerAbort_HasErrorType()
395396
{
396397
var testMeterFactory = new TestMeterFactory();
@@ -399,17 +400,25 @@ public async Task Http1Connection_ServerAbort_HasErrorType()
399400
var serviceContext = new TestServiceContext(LoggerFactory, metrics: new KestrelMetrics(testMeterFactory));
400401

401402
var sendString = "POST / HTTP/1.0\r\nContent-Length: 12\r\n\r\nHello World?";
403+
var finishedSendingTcs = new TaskCompletionSource(TaskCreationOptions.RunContinuationsAsynchronously);
402404

403-
await using var server = new TestServer(c =>
405+
await using var server = new TestServer(async c =>
404406
{
407+
await c.Request.Body.ReadUntilEndAsync();
408+
409+
// An extra check to ensure that client is done sending before the server aborts.
410+
// This might not be necessary since we're reading to the end of the request body, but it doesn't hurt.
411+
await finishedSendingTcs.Task;
412+
405413
c.Abort();
406-
return Task.CompletedTask;
407414
}, serviceContext);
408415

409416
using (var connection = server.CreateConnection())
410417
{
411418
await connection.Send(sendString).DefaultTimeout();
412419

420+
finishedSendingTcs.SetResult();
421+
413422
await connection.ReceiveEnd().DefaultTimeout();
414423

415424
await connection.WaitForConnectionClose().DefaultTimeout();

0 commit comments

Comments
 (0)