소스 검색

testutil: whitelist WaitGroup.Done

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.
Anthony Romano 8 년 전
부모
커밋
5ee89be616
1개의 변경된 파일1개의 추가작업 그리고 0개의 파일을 삭제
  1. 1 0
      pkg/testutil/leak.go

+ 1 - 0
pkg/testutil/leak.go

@@ -118,6 +118,7 @@ func interestingGoroutines() (gs []string) {
 		}
 		}
 		stack := strings.TrimSpace(sl[1])
 		stack := strings.TrimSpace(sl[1])
 		if stack == "" ||
 		if stack == "" ||
+			strings.Contains(stack, "sync.(*WaitGroup).Done") ||
 			strings.Contains(stack, "created by os/signal.init") ||
 			strings.Contains(stack, "created by os/signal.init") ||
 			strings.Contains(stack, "runtime/panic.go") ||
 			strings.Contains(stack, "runtime/panic.go") ||
 			strings.Contains(stack, "created by testing.RunTests") ||
 			strings.Contains(stack, "created by testing.RunTests") ||