Skip to content

Commit

Permalink
Fix flakiness in RequestsCanBeAbortedMidRead (#4881)
Browse files Browse the repository at this point in the history
  • Loading branch information
halter73 authored Dec 15, 2018
1 parent 68f0aff commit 019ba08
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/Servers/Kestrel/test/FunctionalTests/RequestTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1206,7 +1206,12 @@ await connection.Send("POST / HTTP/1.1",
}
}

await Assert.ThrowsAsync<TaskCanceledException>(async () => await readTcs.Task);
var thrownEx = await Assert.ThrowsAnyAsync<Exception>(async () => await readTcs.Task);

// https://github.com/aspnet/AspNetCore-Internal/issues/1521
// In more recent versions of Kestrel, we expect this to always be a TaskCanceledException,
// but without the changes in https://github.com/aspnet/KestrelHttpServer/pull/2844, this is flaky.
Assert.True(thrownEx is TaskCanceledException || thrownEx is IOException, $"{thrownEx} is neither a TaskCanceledException nor IOException.");

// The cancellation token for only the last request should be triggered.
var abortedRequestId = await registrationTcs.Task;
Expand Down

0 comments on commit 019ba08

Please sign in to comment.