Skip to content

Commit

Permalink
testutil: whitelist WaitGroup.Done
Browse files Browse the repository at this point in the history
Calling a WaitGroup.Done() in a defer will sometimes trigger the leak
detector since the WaitGroup.Wait() will unblock before the defer
block completes. If the leak detector runs before the Done() is
rescheduled, it will spuriously report the finishing Done() as a leak.
This happens enough in CI to be irritating; whitelist it and ignore.
  • Loading branch information
heyitsanthony authored and gyuho committed Jul 13, 2017
1 parent 38373b3 commit 5ee89be
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions pkg/testutil/leak.go
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ func interestingGoroutines() (gs []string) {
}
stack := strings.TrimSpace(sl[1])
if stack == "" ||
strings.Contains(stack, "sync.(*WaitGroup).Done") ||
strings.Contains(stack, "created by os/signal.init") ||
strings.Contains(stack, "runtime/panic.go") ||
strings.Contains(stack, "created by testing.RunTests") ||
Expand Down

0 comments on commit 5ee89be

Please sign in to comment.