Skip to content

Commit 896c027

Browse files
authored
Increase shutdown timeout in Kestrel's other TestServer (#8011)
1 parent f5b6039 commit 896c027

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

src/Servers/Kestrel/shared/test/TransportTestHelpers/TestServer.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@ public TestServer(RequestDelegate app, TestServiceContext context, Action<Kestre
9191
configureServices(services);
9292
})
9393
.UseSetting(WebHostDefaults.ApplicationKey, typeof(TestServer).GetTypeInfo().Assembly.FullName)
94+
.UseSetting(WebHostDefaults.ShutdownTimeoutKey, TestConstants.DefaultTimeout.TotalSeconds.ToString())
9495
.Build();
9596

9697
_host.Start();

src/Servers/Kestrel/test/InMemory.FunctionalTests/ConnectionAdapterTests.cs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -151,12 +151,13 @@ public async Task ImmediateShutdownAfterOnConnectionAsyncDoesNotCrash(RequestDel
151151

152152
var stopTask = Task.CompletedTask;
153153
using (var server = new TestServer(requestDelegate, serviceContext, listenOptions))
154-
using (var shutdownCts = new CancellationTokenSource(TimeSpan.FromSeconds(5)))
154+
using (var shutdownCts = new CancellationTokenSource(TestConstants.DefaultTimeout))
155155
{
156156
using (var connection = server.CreateConnection())
157157
{
158-
// Use the default 5 second shutdown timeout. If it hangs that long, we'll look
159-
// at the collected memory dump.
158+
// We assume all CI servers are really slow, so we use a 30 second default test timeout
159+
// instead of the 5 second default production timeout. If this test is still flaky,
160+
// *then* we can consider collecting and investigating memory dumps.
160161
stopTask = server.StopAsync(shutdownCts.Token);
161162
}
162163

0 commit comments

Comments
 (0)