-
Notifications
You must be signed in to change notification settings - Fork 47
Closed
Description
leaktest does not play well with go test -timeout=5s. Regardless, waiting 5 seconds for goroutines to shut down seems excessive. My expectation was that goroutines would be checked as soon as the deferred function was called.
I suggest adding an optional timeout argument to Check, or providing some other way of delaying the check. Note that if Check did not delay by default, you could implement this behavior yourself:
func TestFoo(t testing.T) {
checkFn := leaktest.Check(t)
defer func() {
time.Sleep(5 * time.Second)
checkFn()
}()
}Furthermore, this would give you more fine-grained control over when the check executes. For example, you could wait on a channel before checking. The only reason I propose adding an optional timeout argument is because it seems like a common case.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels