From 5902d51ba40922dedaac3f3369de35bf7f63a6ea Mon Sep 17 00:00:00 2001 From: Andrew Dunham Date: Tue, 3 Oct 2023 17:28:07 -0400 Subject: [PATCH] util/race: add test to confirm we don't leak goroutines Updates #cleanup Signed-off-by: Andrew Dunham Change-Id: Iff147268db50251d498fff5213adb8d4b8c999d4 --- util/race/race_test.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/util/race/race_test.go b/util/race/race_test.go index 9c30e6adb..d38382712 100644 --- a/util/race/race_test.go +++ b/util/race/race_test.go @@ -8,9 +8,13 @@ import ( "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 TestRaceSuccess1(t *testing.T) { } func TestRaceRetry(t *testing.T) { + tstest.ResourceCheck(t) + const want = "fallback" rh := New[string]( 10*time.Second, @@ -48,6 +54,8 @@ func TestRaceRetry(t *testing.T) { } func TestRaceTimeout(t *testing.T) { + tstest.ResourceCheck(t) + const want = "fallback" rh := New[string]( 100*time.Millisecond, @@ -68,6 +76,8 @@ func TestRaceTimeout(t *testing.T) { } func TestRaceError(t *testing.T) { + tstest.ResourceCheck(t) + err1 := errors.New("error 1") err2 := errors.New("error 2")