]> git.feebdaed.xyz Git - 0xmirror/go.git/commit
runtime/pprof: deflake TestGoroutineLeakProfileConcurrency
authorMichael Anthony Knyszek <mknyszek@google.com>
Thu, 11 Dec 2025 17:19:19 +0000 (17:19 +0000)
committerMichael Knyszek <mknyszek@google.com>
Fri, 12 Dec 2025 20:00:25 +0000 (12:00 -0800)
commit8f45611e78095c05075b4cc49e44aabde064e134
tree651536190f5e27f64557b0902a7d3687d22e5fe0
parent34af879dde2cfc2688b486399e9fc7e60d1e96fc
runtime/pprof: deflake TestGoroutineLeakProfileConcurrency

Issue #76540 reports failures in this test from the leaked goroutine
count being too small. The test makes an effort to wait for the
goroutines to leak, but there's no guarantee.

This change instead changes TestGoroutineLeakProfileConcurrency to wait
for the number of leaked goroutines to reach at least the minimum
expected before proceeding. This deflakes this particular issue.

The downside of this change is that a failure to detect leaked
goroutines due to a bug will lead to a timeout instead of an instant
failure, but this change makes an effort to log and report that it was
waiting for the goroutines to leak and timed out for that reason, so at
least the failure is more obvious.

Overall, this is still better than random flakes.

While we're here, I also make some minor stylistic changes and document
the helper functions a little more. I also noticed that checkFrames was
using the wrong *testing.T, so this change fixes that too.

Fixes #76540.

Change-Id: I0508855dc39b91f8c6b72d059ce88dbfc68fe748
Reviewed-on: https://go-review.googlesource.com/c/go/+/729280
Reviewed-by: Cherry Mui <cherryyz@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
src/runtime/pprof/pprof_test.go