Fix flakiness in MaxRequestBufferSizeTests.LargeUpload (#1850).
This commit is contained in:
parent
ded021ba45
commit
6e70b1bcca
|
|
@ -34,7 +34,10 @@ namespace Microsoft.AspNetCore.Server.Kestrel.FunctionalTests
|
||||||
|
|
||||||
private readonly Action<ILoggingBuilder> _configureLoggingDelegate;
|
private readonly Action<ILoggingBuilder> _configureLoggingDelegate;
|
||||||
|
|
||||||
public AddressRegistrationTests(ITestOutputHelper output) => _configureLoggingDelegate = builder => builder.AddXunit(output);
|
public AddressRegistrationTests(ITestOutputHelper output)
|
||||||
|
{
|
||||||
|
_configureLoggingDelegate = builder => builder.AddXunit(output);
|
||||||
|
}
|
||||||
|
|
||||||
[ConditionalFact]
|
[ConditionalFact]
|
||||||
[NetworkIsReachable]
|
[NetworkIsReachable]
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,9 @@ using Microsoft.AspNetCore.Builder;
|
||||||
using Microsoft.AspNetCore.Hosting;
|
using Microsoft.AspNetCore.Hosting;
|
||||||
using Microsoft.AspNetCore.Http;
|
using Microsoft.AspNetCore.Http;
|
||||||
using Microsoft.AspNetCore.Testing;
|
using Microsoft.AspNetCore.Testing;
|
||||||
|
using Microsoft.Extensions.Logging;
|
||||||
using Xunit;
|
using Xunit;
|
||||||
|
using Xunit.Abstractions;
|
||||||
|
|
||||||
namespace Microsoft.AspNetCore.Server.Kestrel.FunctionalTests
|
namespace Microsoft.AspNetCore.Server.Kestrel.FunctionalTests
|
||||||
{
|
{
|
||||||
|
|
@ -28,6 +30,13 @@ namespace Microsoft.AspNetCore.Server.Kestrel.FunctionalTests
|
||||||
"\r\n"
|
"\r\n"
|
||||||
};
|
};
|
||||||
|
|
||||||
|
private readonly Action<ILoggingBuilder> _configureLoggingDelegate;
|
||||||
|
|
||||||
|
public MaxRequestBufferSizeTests(ITestOutputHelper output)
|
||||||
|
{
|
||||||
|
_configureLoggingDelegate = builder => builder.AddXunit(output);
|
||||||
|
}
|
||||||
|
|
||||||
public static IEnumerable<object[]> LargeUploadData
|
public static IEnumerable<object[]> LargeUploadData
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
|
|
@ -243,13 +252,14 @@ namespace Microsoft.AspNetCore.Server.Kestrel.FunctionalTests
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static IWebHost StartWebHost(long? maxRequestBufferSize,
|
private IWebHost StartWebHost(long? maxRequestBufferSize,
|
||||||
byte[] expectedBody,
|
byte[] expectedBody,
|
||||||
bool useConnectionAdapter,
|
bool useConnectionAdapter,
|
||||||
TaskCompletionSource<object> startReadingRequestBody,
|
TaskCompletionSource<object> startReadingRequestBody,
|
||||||
TaskCompletionSource<object> clientFinishedSendingRequestBody)
|
TaskCompletionSource<object> clientFinishedSendingRequestBody)
|
||||||
{
|
{
|
||||||
var host = new WebHostBuilder()
|
var host = new WebHostBuilder()
|
||||||
|
.ConfigureLogging(_configureLoggingDelegate)
|
||||||
.UseKestrel(options =>
|
.UseKestrel(options =>
|
||||||
{
|
{
|
||||||
options.Listen(new IPEndPoint(IPAddress.Loopback, 0), listenOptions =>
|
options.Listen(new IPEndPoint(IPAddress.Loopback, 0), listenOptions =>
|
||||||
|
|
@ -279,7 +289,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.FunctionalTests
|
||||||
.UseContentRoot(Directory.GetCurrentDirectory())
|
.UseContentRoot(Directory.GetCurrentDirectory())
|
||||||
.Configure(app => app.Run(async context =>
|
.Configure(app => app.Run(async context =>
|
||||||
{
|
{
|
||||||
await startReadingRequestBody.Task.TimeoutAfter(TimeSpan.FromSeconds(30));
|
await startReadingRequestBody.Task.TimeoutAfter(TimeSpan.FromSeconds(120));
|
||||||
|
|
||||||
var buffer = new byte[expectedBody.Length];
|
var buffer = new byte[expectedBody.Length];
|
||||||
var bytesRead = 0;
|
var bytesRead = 0;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue