testleak

package
v0.2.2-0...-80432f9 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 17, 2021 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Check

func Check(t *testing.T, maxWait time.Duration, ignores ...gotrace.Ignore)

Check reports error if the test is leaking goroutine. Default timeout is 3s. Default ignore is gotrace.IgnoreCurrent() .

This check will become useless if t.Parallel() is called for multiple tests, because the test framework will execute tests at the same time which makes it impossible to write a correct ignore function to detect which goroutine is spawned by current test. But you can still use CheckMain to check leak, because it runs after all tests are settled.

func CheckMain

func CheckMain(m *testing.M, maxWait time.Duration, ignores ...gotrace.Ignore)

CheckMain reports error if goroutines are leaking after all tests are done. Default timeout is 3s. It's powerful but less accurate than Check, if you only use CheckMain it will be hard to tell which test is the cause of the leak.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL