Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AssertNoGoroutines ¶
func AssertNoGoroutines(t Errorf) func()
AssertNoGoroutines is used to detect goroutine leaks.
Usage is as shown below:
func TestExample(t *testing.T) { defer synctestutil.AssertNoGoroutines(t, time.Second)() ... }
Note that in the example above AssertNoGoroutines returns a function that is immediately defered. The call to AssertNoGoroutines records the currently goroutines and the returned function will compare that initial set to those running when it is invoked. Hence, the above example is equivalent to:
func TestExample(t *testing.T) { fn := synctestutil.AssertNoGoroutines(t, time.Second) ... fn() }
func AssertNoGoroutinesRacy ¶
AssertNoGoroutinesRacy is like AssertNoGoroutines but allows for a grace period for goroutines to terminate.
Types ¶
Click to show internal directories.
Click to hide internal directories.