Skip to content

Commit 38204e0

Browse files
seankhliaoadonovan
authored andcommitted
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 <[email protected]> Reviewed-by: Damien Neil <[email protected]> LUCI-TryBot-Result: Go LUCI <[email protected]> Reviewed-by: Alan Donovan <[email protected]>
1 parent 252c901 commit 38204e0

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/testing/synctest/synctest.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,14 @@
77
// The [Test] function runs a function in an isolated "bubble".
88
// Any goroutines started within the bubble are also part of the bubble.
99
//
10+
// Each test should be entirely self-contained:
11+
// The following guidelines should apply to most tests:
12+
//
13+
// - Avoid interacting with goroutines not started from within the test.
14+
// - Avoid using the network. Use a fake network implementation as needed.
15+
// - Avoid interacting with external processes.
16+
// - Avoid leaking goroutines in background tasks.
17+
//
1018
// # Time
1119
//
1220
// Within a bubble, the [time] package uses a fake clock.

0 commit comments

Comments
 (0)