aboutsummaryrefslogtreecommitdiff
path: root/src/testing
diff options
context:
space:
mode:
authorDamien Neil <dneil@google.com>2025-04-01 15:43:22 -0700
committerGopher Robot <gobot@golang.org>2025-05-07 13:14:25 -0700
commitd6c8bedc7b3d2de7714dca75bd05912b371538f1 (patch)
tree352d43791d26d75bed756a7b02ef69b872483872 /src/testing
parent4e63ae46e097062b72424b2ac1da6e7dac33064b (diff)
downloadgo-d6c8bedc7b3d2de7714dca75bd05912b371538f1.tar.xz
runtime, testing/synctest: stop advancing time when main goroutine exits
Once the goroutine started by synctest.Run exits, stop advancing the fake clock in its bubble. This avoids confusing situations where a bubble remains alive indefinitely while a background goroutine reads from a time.Ticker or otherwise advances the clock. For #67434 Change-Id: Id608ffe3c7d7b07747b56a21f365787fb9a057d7 Reviewed-on: https://go-review.googlesource.com/c/go/+/662155 Reviewed-by: Michael Pratt <mpratt@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Auto-Submit: Damien Neil <dneil@google.com>
Diffstat (limited to 'src/testing')
-rw-r--r--src/testing/synctest/synctest.go5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/testing/synctest/synctest.go b/src/testing/synctest/synctest.go
index 90efc789de..1b1aef2e79 100644
--- a/src/testing/synctest/synctest.go
+++ b/src/testing/synctest/synctest.go
@@ -28,7 +28,10 @@ import (
// goroutines are blocked and return after the bubble's clock has
// advanced. See [Wait] for the specific definition of blocked.
//
-// If every goroutine is blocked and there are no timers scheduled,
+// Time stops advancing when f returns.
+//
+// If every goroutine is blocked and either
+// no timers are scheduled or f has returned,
// Run panics.
//
// Channels, time.Timers, and time.Tickers created within the bubble