From 7b162aa4bc0bfbdb93d53b00a5f0f0e285a9a0a3 Mon Sep 17 00:00:00 2001 From: Alberto Balbo Date: Fri, 4 Dec 2026 14:45:36 +0100 Subject: [PATCH] Give the engine health test thirty seconds instead of a hundred polls The test waited for the engine to start for at most a hundred polls, about ten seconds, and passed in eleven on PostgreSQL in CI. Phase 13 adds CPU-heavy tournament and control tests that run in parallel with it, and on a busy runner the engine took longer to start, so the test failed with the engine still starting. It now waits up to thirty seconds of wall time, polling as before; it still requires the engine to reach ok, then not started, then ok again. refs #126 Co-Authored-By: Claude Opus 5.5 --- tests/Anubis.Tests/HealthEndpointTests.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tests/Anubis.Tests/HealthEndpointTests.cs b/tests/Anubis.Tests/HealthEndpointTests.cs index 82c509e..915a80a 100644 --- a/tests/Anubis.Tests/HealthEndpointTests.cs +++ b/tests/Anubis.Tests/HealthEndpointTests.cs @@ -1,3 +1,4 @@ +using System.Diagnostics; using System.Net; using System.Net.Http.Json; using Anubis.Server; @@ -37,10 +38,12 @@ public sealed class HealthEndpointTests return (await response.Content.ReadFromJsonAsync())!; } + // Up to 30 seconds of wall time: on a busy test runner the engine can take more than ten to start. async Task UntilAsync(string status, string loop) { HealthResponse? last = null; - for (var i = 0; i < 100; i++) + var deadline = Stopwatch.StartNew(); + while (last is null || deadline.Elapsed < TimeSpan.FromSeconds(30)) { last = await HealthAsync(); if (last.Status == status && last.Checks!.GetValueOrDefault("motore") == loop)