Remove FlushResultCancellationTests as it isn't relevant (#4435)
This commit is contained in:
parent
63e2beb749
commit
e9c4c935f6
|
|
@ -12,44 +12,6 @@ namespace Microsoft.AspNetCore.Http.Tests
|
|||
{
|
||||
public class FlushResultCancellationTests : PipeTest
|
||||
{
|
||||
[Fact]
|
||||
public void FlushAsyncCancellationDeadlock()
|
||||
{
|
||||
var cts = new CancellationTokenSource();
|
||||
var cts2 = new CancellationTokenSource();
|
||||
|
||||
PipeWriter buffer = Writer.WriteEmpty(MaximumSizeHigh);
|
||||
|
||||
var e = new ManualResetEventSlim();
|
||||
|
||||
ValueTaskAwaiter<FlushResult> awaiter = buffer.FlushAsync(cts.Token).GetAwaiter();
|
||||
awaiter.OnCompleted(
|
||||
() => {
|
||||
// We are on cancellation thread and need to wait until another FlushAsync call
|
||||
// takes pipe state lock
|
||||
e.Wait();
|
||||
|
||||
// Make sure we had enough time to reach _cancellationTokenRegistration.Dispose
|
||||
Thread.Sleep(100);
|
||||
|
||||
// Try to take pipe state lock
|
||||
buffer.FlushAsync();
|
||||
});
|
||||
|
||||
// Start a thread that would run cancellation callbacks
|
||||
Task cancellationTask = Task.Run(() => cts.Cancel());
|
||||
// Start a thread that would call FlushAsync with different token
|
||||
// and block on _cancellationTokenRegistration.Dispose
|
||||
Task blockingTask = Task.Run(
|
||||
() => {
|
||||
e.Set();
|
||||
buffer.FlushAsync(cts2.Token);
|
||||
});
|
||||
|
||||
bool completed = Task.WhenAll(cancellationTask, blockingTask).Wait(TimeSpan.FromSeconds(10));
|
||||
Assert.True(completed);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task FlushAsyncWithNewCancellationTokenNotAffectedByPrevious()
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in New Issue