Skip to content

Commit

Permalink
Document incompatibility of VerifyNone with t.Parallel (#107)
Browse files Browse the repository at this point in the history
It's a known issue that goleak is incompatible with tests being run in
parallel.
* #16
* #83

Unfortunately, there is no real solution to this issue.
* #16 (comment)
* #83 (comment)
* #83 (comment)

This PR at least documents the incompatibility
and suggests using `VerifyTestMain` instead.
  • Loading branch information
JacobOaks authored Oct 12, 2023
1 parent 3e8744f commit 03cb6e6
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions leaks.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,12 @@ type testHelper interface {
// tests by doing:
//
// defer VerifyNone(t)
//
// VerifyNone is currently incompatible with t.Parallel because it cannot
// associate specific goroutines with specific tests. Thus, non-leaking
// goroutines from other tests running in parallel could fail this check.
// If you need to run tests in parallel, use [VerifyTestMain] instead,
// which will verify that no leaking goroutines exist after ALL tests finish.
func VerifyNone(t TestingT, options ...Option) {
opts := buildOpts(options...)
var cleanup func(int)
Expand Down

0 comments on commit 03cb6e6

Please sign in to comment.