Skip to content

Commit c8fd0bd

Browse files
committed
Ignore random kcp operation goroutines when testing for workspace deletion leaks
Signed-off-by: Nelo-T. Wallus <[email protected]> Signed-off-by: Nelo-T. Wallus <[email protected]>
1 parent 6d2bd37 commit c8fd0bd

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

test/integration/workspace/leak_test.go

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,17 @@ func createAndDeleteWs(ctx context.Context, t *testing.T, kcpClient kcpclientset
8888
time.Sleep(2 * time.Second)
8989
}
9090

91+
var (
92+
// These are goroutines that can pop up randomly during KCP
93+
// operations and aren't indicative of a leak when deleting
94+
// a workspace.
95+
randomGoroutineSources = []goleak.Option{
96+
goleak.IgnoreCreatedBy("net/http.(*Server).Serve"),
97+
goleak.IgnoreCreatedBy("golang.org/x/net/http2.(*Transport).newClientConn"),
98+
goleak.IgnoreCreatedBy("golang.org/x/net/http2.(*serverConn).serve"),
99+
}
100+
)
101+
91102
func TestWorkspaceDeletionLeak(t *testing.T) {
92103
ctx, cancel := context.WithCancel(context.Background())
93104
t.Cleanup(cancel) // TODO update in go1.24
@@ -105,7 +116,7 @@ func TestWorkspaceDeletionLeak(t *testing.T) {
105116

106117
t.Logf("Check for leftover goroutines")
107118
kcptestinghelpers.Eventually(t, func() (bool, string) {
108-
if err := goleak.Find(curGoroutines); err != nil {
119+
if err := goleak.Find(append(randomGoroutineSources, curGoroutines)...); err != nil {
109120
return false, err.Error()
110121
}
111122
return true, ""

0 commit comments

Comments
 (0)