Give the engine health test thirty seconds instead of a hundred polls
ci / test (postgres) (push) Successful in 9m39s
ci / test (sqlite) (push) Successful in 8m6s
ci / test (postgres) (pull_request) Successful in 10m13s
ci / test (sqlite) (pull_request) Successful in 7m36s
ci / image (push) Successful in 1m55s
ci / image (pull_request) Successful in 58s

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 <noreply@anthropic.com>
This commit is contained in:
Alby96andClaude Opus 5.5 committed 2026-12-04 14:45:36 +01:00
1 parent 9e98c70727
commit 7b162aa4bc
1 file changed
+4 -1
+4 -1
View File
@@ -1,3 +1,4 @@
using System.Diagnostics;
using System.Net; using System.Net;
using System.Net.Http.Json; using System.Net.Http.Json;
using Anubis.Server; using Anubis.Server;
@@ -37,10 +38,12 @@ public sealed class HealthEndpointTests
return (await response.Content.ReadFromJsonAsync<HealthResponse>())!; return (await response.Content.ReadFromJsonAsync<HealthResponse>())!;
} }
// 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) async Task UntilAsync(string status, string loop)
{ {
HealthResponse? last = null; 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(); last = await HealthAsync();
if (last.Status == status && last.Checks!.GetValueOrDefault("motore") == loop) if (last.Status == status && last.Checks!.GetValueOrDefault("motore") == loop)