Increase shutdown timeout in Kestrel's other TestServer (#8011)

This commit is contained in:
Stephen Halter 2019-02-27 18:15:25 -08:00 committed by GitHub
parent f5b6039add
commit 896c027010
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 3 deletions

View File

@ -91,6 +91,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.FunctionalTests
configureServices(services); configureServices(services);
}) })
.UseSetting(WebHostDefaults.ApplicationKey, typeof(TestServer).GetTypeInfo().Assembly.FullName) .UseSetting(WebHostDefaults.ApplicationKey, typeof(TestServer).GetTypeInfo().Assembly.FullName)
.UseSetting(WebHostDefaults.ShutdownTimeoutKey, TestConstants.DefaultTimeout.TotalSeconds.ToString())
.Build(); .Build();
_host.Start(); _host.Start();

View File

@ -151,12 +151,13 @@ namespace Microsoft.AspNetCore.Server.Kestrel.InMemory.FunctionalTests
var stopTask = Task.CompletedTask; var stopTask = Task.CompletedTask;
using (var server = new TestServer(requestDelegate, serviceContext, listenOptions)) using (var server = new TestServer(requestDelegate, serviceContext, listenOptions))
using (var shutdownCts = new CancellationTokenSource(TimeSpan.FromSeconds(5))) using (var shutdownCts = new CancellationTokenSource(TestConstants.DefaultTimeout))
{ {
using (var connection = server.CreateConnection()) using (var connection = server.CreateConnection())
{ {
// Use the default 5 second shutdown timeout. If it hangs that long, we'll look // We assume all CI servers are really slow, so we use a 30 second default test timeout
// at the collected memory dump. // instead of the 5 second default production timeout. If this test is still flaky,
// *then* we can consider collecting and investigating memory dumps.
stopTask = server.StopAsync(shutdownCts.Token); stopTask = server.StopAsync(shutdownCts.Token);
} }