Merge pull request #18416 from roidelapluie/roidelapluie/rules-alerting-test-debug
Some checks are pending
buf.build / lint and publish (push) Waiting to run
CI / Go tests (push) Waiting to run
CI / More Go tests (push) Waiting to run
CI / Go tests for Prometheus upgrades and downgrades (push) Waiting to run
CI / Go tests with previous Go version (push) Waiting to run
CI / UI tests (push) Waiting to run
CI / Go tests on Windows (push) Waiting to run
CI / Mixins tests (push) Waiting to run
CI / Compliance testing (push) Waiting to run
CI / Build Prometheus for common architectures (push) Waiting to run
CI / Build Prometheus for all architectures (push) Waiting to run
CI / Report status of build Prometheus for all architectures (push) Blocked by required conditions
CI / Check generated parser (push) Waiting to run
CI / golangci-lint (push) Waiting to run
CI / fuzzing (push) Waiting to run
CI / codeql (push) Waiting to run
CI / Publish main branch artifacts (push) Blocked by required conditions
CI / Publish release artefacts (push) Blocked by required conditions
CI / Publish UI on npm Registry (push) Blocked by required conditions
Scorecards supply-chain security / Scorecards analysis (push) Waiting to run

rules: add goroutine dump and increase timeout in template test
This commit is contained in:
Julien 2026-04-07 15:45:46 +02:00 committed by GitHub
commit 9899ab3706
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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.")
}
}