Centralize test timeout constants to fix CI flakiness (#1224)

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: ericstj <8918108+ericstj@users.noreply.github.com>
Co-authored-by: Eric StJohn <ericstj@microsoft.com>
This commit is contained in:
Copilot 2026-01-30 13:47:11 -08:00 • committed by GitHub
commit a83d6198a5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1,5 +1,6 @@
using System.Diagnostics;
using System.Net;
using ModelContextProtocol.Tests.Utils;
namespace ModelContextProtocol.Tests;
@ -33,7 +34,7 @@ public class EverythingSseServerFixture : IAsyncDisposable
?? throw new InvalidOperationException($"Could not start process for {processStartInfo.FileName} with '{processStartInfo.Arguments}'.");
// Poll until the server is ready (up to 30 seconds)
using var httpClient = new HttpClient { Timeout = TimeSpan.FromSeconds(2) };
using var httpClient = new HttpClient { Timeout = TestConstants.HttpClientPollingTimeout };
var endpoint = $"http://localhost:{_port}/sse";
var deadline = DateTime.UtcNow.AddSeconds(30);
@ -72,7 +73,7 @@ public class EverythingSseServerFixture : IAsyncDisposable
using var stopProcess = Process.Start(stopInfo)
?? throw new InvalidOperationException($"Could not stop process for {stopInfo.FileName} with '{stopInfo.Arguments}'.");
await stopProcess.WaitForExitAsync(TimeSpan.FromSeconds(10));
await stopProcess.WaitForExitAsync(TestConstants.DefaultTimeout);
}
catch (Exception ex)
{