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