From 99673b108784369dd72710ba1de51fcab86b34b7 Mon Sep 17 00:00:00 2001 From: mhx Date: Fri, 31 Jul 2026 19:26:04 +0200 Subject: [PATCH] :bug: e2e: stop racing the deadline in the stream failure check handleStreamTicker compares updateFailure to updateMaxFailure before incrementing it, so with updateMaxFailure 2 and a 1s interval the bouncer gives up on the third consecutive failed poll, roughly 3s after the endpoint starts failing. The check slept 2s and then polled for a 200 for up to 15s, leaving about a second of margin, and once that window closes it never reopens: a runner under load turns this into a 15s wait followed by a failure. Assert the 200 immediately after the endpoint starts failing, which is always inside the window, and keep polling for the 403 that follows. --- tests/e2e/mock/scenarios/stream-mode/run.sh | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/tests/e2e/mock/scenarios/stream-mode/run.sh b/tests/e2e/mock/scenarios/stream-mode/run.sh index a47d63e..4b97ba1 100755 --- a/tests/e2e/mock/scenarios/stream-mode/run.sh +++ b/tests/e2e/mock/scenarios/stream-mode/run.sh @@ -34,10 +34,11 @@ body() { echo "[$SCENARIO] previously CIDR-banned IP must pass again once deletion is polled" wait_for_status "http://127.0.0.1:${WEB_PORT}/foo" 200 15 -H "X-Forwarded-For: 10.0.0.1" - echo "[$SCENARIO] making the stream endpoint fail -> bouncer must pass for one more cycle (updateMaxFailure: 2)" + echo "[$SCENARIO] making the stream endpoint fail -> bouncer must still pass (updateMaxFailure: 2)" lapi_set_stream_fail - sleep 2 # update cache is every 1 seconds then waiting for minimum 1 cycle - wait_for_status "http://127.0.0.1:${WEB_PORT}/foo" 200 15 -H "X-Forwarded-For: 8.8.8.8" + # No sleep: the bouncer gives up on the third failed poll, so at a 1s interval the + # window where it still serves is ~3s wide and never reopens. Assert inside it. + assert_status "http://127.0.0.1:${WEB_PORT}/foo" 200 -H "X-Forwarded-For: 8.8.8.8" echo "[$SCENARIO] bouncer must block everything (isStreamHealthy: false)" wait_for_status "http://127.0.0.1:${WEB_PORT}/foo" 403 15 -H "X-Forwarded-For: 8.8.8.8"