From 3c9244f3caa2adc467525a8c13a1c9a23855ca9c Mon Sep 17 00:00:00 2001 From: Alexander Medvednikov Date: Tue, 26 May 2026 13:09:09 +0300 Subject: [PATCH] context: poll instead of fixed sleep in `with_timeout_cause` test Busy macos-14 CI runners take well over 60ms to schedule the deadline goroutine, so the fixed sleep flaked. Poll up to 2s instead. --- vlib/context/cause_test.v | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/vlib/context/cause_test.v b/vlib/context/cause_test.v index b20a3942e..57b034816 100644 --- a/vlib/context/cause_test.v +++ b/vlib/context/cause_test.v @@ -75,8 +75,12 @@ fn test_with_timeout_cause_fires_cause() { // not done yet assert ctx.err() is none - // wait for timeout - time.sleep(60 * time.millisecond) + // poll for the deadline goroutine to record the cancellation; busy CI + // runners can take well over 60ms to schedule it. + deadline := time.now().add(2 * time.second) + for ctx.err() is none && time.now() < deadline { + time.sleep(5 * time.millisecond) + } assert ctx.err().str() == 'context deadline exceeded' assert cause(ctx).str() == 'timed out for testing' -- 2.39.5