fix(tests): warm up liveness endpoint before timing to fix flaky 3.10 CI

test_health_live_is_fast timed the first request through the Starlette
TestClient, which pays one-time route/client initialization cost and
measured 0.15s on a slow Python 3.10 runner (threshold 0.1s). Add a
warmup request so the assertion measures steady-state latency, matching
the endpoint's own <500ms target. No production code change.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
This commit is contained in:
MervinPraisonandClaude Opus 4.8 committed 2026-09-07 19:26:06 +00:00
1 parent bfb1eeee06
commit d615e2e0a3
1 file changed
+5
+5
View File
@@ -55,6 +55,11 @@ class TestHealthEndpoint:
"""Test liveness endpoint returns quickly."""
import time
# Warm up once so the timed call measures steady-state latency rather
# than one-time TestClient/route initialization (which can exceed the
# threshold on slow CI runners and cause flaky failures).
client.get("/health/live")
start = time.time()
response = client.get("/health/live")
duration = time.time() - start