mirror of
https://github.com/tailscale/tailscale.git
synced 2024-11-29 04:55:31 +00:00
util/race: add test to confirm we don't leak goroutines
Updates #cleanup Signed-off-by: Andrew Dunham <andrew@du.nham.ca> Change-Id: Iff147268db50251d498fff5213adb8d4b8c999d4
This commit is contained in:
parent
286c6ce27c
commit
5902d51ba4
@ -8,9 +8,13 @@
|
||||
"errors"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"tailscale.com/tstest"
|
||||
)
|
||||
|
||||
func TestRaceSuccess1(t *testing.T) {
|
||||
tstest.ResourceCheck(t)
|
||||
|
||||
const want = "success"
|
||||
rh := New[string](
|
||||
10*time.Second,
|
||||
@ -30,6 +34,8 @@ func(context.Context) (string, error) {
|
||||
}
|
||||
|
||||
func TestRaceRetry(t *testing.T) {
|
||||
tstest.ResourceCheck(t)
|
||||
|
||||
const want = "fallback"
|
||||
rh := New[string](
|
||||
10*time.Second,
|
||||
@ -48,6 +54,8 @@ func(context.Context) (string, error) {
|
||||
}
|
||||
|
||||
func TestRaceTimeout(t *testing.T) {
|
||||
tstest.ResourceCheck(t)
|
||||
|
||||
const want = "fallback"
|
||||
rh := New[string](
|
||||
100*time.Millisecond,
|
||||
@ -68,6 +76,8 @@ func(ctx context.Context) (string, error) {
|
||||
}
|
||||
|
||||
func TestRaceError(t *testing.T) {
|
||||
tstest.ResourceCheck(t)
|
||||
|
||||
err1 := errors.New("error 1")
|
||||
err2 := errors.New("error 2")
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user