test(mcp): give the hang-on-start discovery test a 3 s startup timeout
The fake logs its start only after the .NET runtime is up; under full-suite load that took over 1 s, the client killed it first and the start entry was missing.
This commit is contained in:
@@ -117,12 +117,14 @@ public class McpCatalogCacheTests : IDisposable
|
||||
[Fact]
|
||||
public async Task Hang_on_start_gives_up_after_the_startup_timeout()
|
||||
{
|
||||
var config = FakeMcp.Server("hang-on-start,count-starts", LogPath, c => c.StartupTimeoutSeconds = 1);
|
||||
// 3 s, not 1: the fake logs its start only after the .NET runtime is up, which can take over a second while
|
||||
// the whole suite runs in parallel. A shorter timeout kills it before it logs and the Single below fails.
|
||||
var config = FakeMcp.Server("hang-on-start,count-starts", LogPath, c => c.StartupTimeoutSeconds = 3);
|
||||
var watch = Stopwatch.StartNew();
|
||||
|
||||
var ex = await Assert.ThrowsAsync<McpServerStartException>(() => Discover(new McpCatalogCache(_time), config));
|
||||
|
||||
Assert.Contains("did not start within 1s", ex.Message, StringComparison.Ordinal);
|
||||
Assert.Contains("did not start within 3s", ex.Message, StringComparison.Ordinal);
|
||||
Assert.True(watch.Elapsed < TimeSpan.FromSeconds(15), $"took {watch.Elapsed}");
|
||||
var pid = Assert.Single(FakeMcp.Starts(LogPath)).GetProperty("pid").GetInt32();
|
||||
await FakeMcp.WaitForAsync(() => FakeMcp.HasExited(pid), "the hung server to be stopped");
|
||||
|
||||
Reference in New Issue
Block a user