parent
9e80fb65bd
commit
e3e78bc461
|
|
@ -247,6 +247,8 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Transport.Libuv.Tests
|
|||
[Theory]
|
||||
[MemberData(nameof(PositiveMaxResponseBufferSizeData))]
|
||||
public async Task WritesDontCompleteImmediatelyWhenTooManyBytesIncludingNonImmediateAreAlreadyBuffered(int maxResponseBufferSize)
|
||||
{
|
||||
await Task.Run(async () =>
|
||||
{
|
||||
var completeQueue = new ConcurrentQueue<Action<int>>();
|
||||
|
||||
|
|
@ -280,7 +282,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Transport.Libuv.Tests
|
|||
Assert.NotEmpty(completeQueue);
|
||||
|
||||
// Add more bytes to the write-behind buffer to prevent the next write from
|
||||
((ISocketOutput)socketOutput).Write((writableBuffer, state) =>
|
||||
((ISocketOutput) socketOutput).Write((writableBuffer, state) =>
|
||||
{
|
||||
writableBuffer.Write(state);
|
||||
},
|
||||
|
|
@ -306,11 +308,14 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Transport.Libuv.Tests
|
|||
|
||||
Assert.Empty(completeQueue);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[MemberData(nameof(PositiveMaxResponseBufferSizeData))]
|
||||
public async Task FailedWriteCompletesOrCancelsAllPendingTasks(int maxResponseBufferSize)
|
||||
{
|
||||
await Task.Run(async () =>
|
||||
{
|
||||
var completeQueue = new ConcurrentQueue<Action<int>>();
|
||||
|
||||
|
|
@ -387,11 +392,14 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Transport.Libuv.Tests
|
|||
|
||||
Assert.True(abortedSource.IsCancellationRequested);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[MemberData(nameof(PositiveMaxResponseBufferSizeData))]
|
||||
public async Task CancelsBeforeWriteRequestCompletes(int maxResponseBufferSize)
|
||||
{
|
||||
await Task.Run(async () =>
|
||||
{
|
||||
var completeQueue = new ConcurrentQueue<Action<int>>();
|
||||
|
||||
|
|
@ -459,11 +467,14 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Transport.Libuv.Tests
|
|||
|
||||
Assert.True(abortedSource.IsCancellationRequested);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[MemberData(nameof(PositiveMaxResponseBufferSizeData))]
|
||||
public async Task WriteAsyncWithTokenAfterCallWithoutIsCancelled(int maxResponseBufferSize)
|
||||
{
|
||||
await Task.Run(async () =>
|
||||
{
|
||||
var completeQueue = new ConcurrentQueue<Action<int>>();
|
||||
|
||||
|
|
@ -533,6 +544,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Transport.Libuv.Tests
|
|||
await Assert.ThrowsAsync<OperationCanceledException>(() => task3Canceled);
|
||||
Assert.True(task3Canceled.IsCanceled);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
[Theory]
|
||||
|
|
|
|||
Loading…
Reference in New Issue