From 896c027010d2eef2c71e0ef2113208671428e989 Mon Sep 17 00:00:00 2001 From: Stephen Halter Date: Wed, 27 Feb 2019 18:15:25 -0800 Subject: [PATCH] Increase shutdown timeout in Kestrel's other TestServer (#8011) --- .../Kestrel/shared/test/TransportTestHelpers/TestServer.cs | 1 + .../InMemory.FunctionalTests/ConnectionAdapterTests.cs | 7 ++++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/Servers/Kestrel/shared/test/TransportTestHelpers/TestServer.cs b/src/Servers/Kestrel/shared/test/TransportTestHelpers/TestServer.cs index 6445cbe32c..30ea7f3623 100644 --- a/src/Servers/Kestrel/shared/test/TransportTestHelpers/TestServer.cs +++ b/src/Servers/Kestrel/shared/test/TransportTestHelpers/TestServer.cs @@ -91,6 +91,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.FunctionalTests configureServices(services); }) .UseSetting(WebHostDefaults.ApplicationKey, typeof(TestServer).GetTypeInfo().Assembly.FullName) + .UseSetting(WebHostDefaults.ShutdownTimeoutKey, TestConstants.DefaultTimeout.TotalSeconds.ToString()) .Build(); _host.Start(); diff --git a/src/Servers/Kestrel/test/InMemory.FunctionalTests/ConnectionAdapterTests.cs b/src/Servers/Kestrel/test/InMemory.FunctionalTests/ConnectionAdapterTests.cs index 017e175fa6..814173f2c9 100644 --- a/src/Servers/Kestrel/test/InMemory.FunctionalTests/ConnectionAdapterTests.cs +++ b/src/Servers/Kestrel/test/InMemory.FunctionalTests/ConnectionAdapterTests.cs @@ -151,12 +151,13 @@ namespace Microsoft.AspNetCore.Server.Kestrel.InMemory.FunctionalTests var stopTask = Task.CompletedTask; 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()) { - // Use the default 5 second shutdown timeout. If it hangs that long, we'll look - // at the collected memory dump. + // We assume all CI servers are really slow, so we use a 30 second default test timeout + // 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); }