From fb2136488729a20f4c7caba3a7c35e4f56988885 Mon Sep 17 00:00:00 2001 From: Julien Pivotto <291750+roidelapluie@users.noreply.github.com> Date: Tue, 31 Mar 2026 17:53:52 +0200 Subject: [PATCH] rules: add goroutine dump and increase timeout in template test Increase the blocking detection timeout from 10ms to 20ms to reduce flakiness, and add a goroutine dump on timeout to aid debugging. Signed-off-by: Julien Pivotto <291750+roidelapluie@users.noreply.github.com> --- rules/alerting_test.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/rules/alerting_test.go b/rules/alerting_test.go index e2586ee959..cb16a84daf 100644 --- a/rules/alerting_test.go +++ b/rules/alerting_test.go @@ -16,6 +16,7 @@ package rules import ( "context" "errors" + "runtime" "testing" "time" @@ -538,8 +539,11 @@ instance: {{ $v.Labels.instance }}, value: {{ printf "%.0f" $v.Value }}; close(startQueryCh) select { case <-getDoneCh: - case <-time.After(time.Millisecond * 10): + case <-time.After(20 * time.Millisecond): // Assert no blocking when template expanding. + buf := make([]byte, 1<<20) + n := runtime.Stack(buf, true) + t.Logf("goroutine dump:\n%s", buf[:n]) require.Fail(t, "unexpected blocking when template expanding.") } }