From 38204e087267a3408e36aa23d2b5ac36f22feef3 Mon Sep 17 00:00:00 2001 From: Sean Liao Date: Sun, 17 Aug 2025 12:29:48 +0100 Subject: [PATCH] testing/synctest: call out common issues with tests While each point is explained their respective sections for Time, Blocking, and Isolation, these appear to be the most common issues worth calling out up front. Fixes #75052 Change-Id: I916b559075ee4d1d23810a08459e037e21690193 Reviewed-on: https://go-review.googlesource.com/c/go/+/696736 Auto-Submit: Damien Neil Reviewed-by: Damien Neil LUCI-TryBot-Result: Go LUCI Reviewed-by: Alan Donovan --- src/testing/synctest/synctest.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/testing/synctest/synctest.go b/src/testing/synctest/synctest.go index ff88c3ec42..707383f9c7 100644 --- a/src/testing/synctest/synctest.go +++ b/src/testing/synctest/synctest.go @@ -7,6 +7,14 @@ // The [Test] function runs a function in an isolated "bubble". // Any goroutines started within the bubble are also part of the bubble. // +// Each test should be entirely self-contained: +// The following guidelines should apply to most tests: +// +// - Avoid interacting with goroutines not started from within the test. +// - Avoid using the network. Use a fake network implementation as needed. +// - Avoid interacting with external processes. +// - Avoid leaking goroutines in background tasks. +// // # Time // // Within a bubble, the [time] package uses a fake clock. -- 2.52.0