Remove FlushResultCancellationTests as it isn't relevant (#4435)

This commit is contained in:
Justin Kotalik 2018-12-05 12:05:05 -08:00 committed by GitHub
parent 63e2beb749
commit e9c4c935f6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 0 additions and 38 deletions

View File

@ -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()
{