Skip to content

Commit 0f347b1

Browse files
committed
Updated a few flaky entries. Unclogged output printing.
1 parent ccdd588 commit 0f347b1

File tree

1 file changed

+14
-5
lines changed

1 file changed

+14
-5
lines changed

src/runtime/gc_test.go

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1414,13 +1414,13 @@ func TestGoroutineLeakGC(t *testing.T) {
14141414
`\(\*statusManager_kubernetes10182\)\.SetPodStatus\(.* \[chan send\]`,
14151415
),
14161416
makeFlakyTest("Kubernetes11298",
1417-
// This entire test is flaky in producing leaks. Run it only to check for crashes.
14181417
`After_kubernetes11298\.func1\(.* \[chan receive\]`,
14191418
`After_kubernetes11298\.func1\(.* \[sync\.Cond\.Wait\]`,
14201419
`Kubernetes11298\.func2\(.* \[chan receive\]`,
14211420
),
14221421
makeFlakyTest("Kubernetes13135",
1423-
`Kubernetes13135\.func2\(.* \[sync\.WaitGroup\.Wait\]`,
1422+
`Util_kubernetes13135\(.* \[sync\.Mutex\.Lock\]`,
1423+
`\(\*WatchCache_kubernetes13135\)\.Add\(.* \[sync\.Mutex\.Lock\]`,
14241424
),
14251425
makeTest("Kubernetes25331",
14261426
`\(\*watchChan_kubernetes25331\)\.run\(.* \[chan send\]`,
@@ -1459,7 +1459,7 @@ func TestGoroutineLeakGC(t *testing.T) {
14591459
makeTest("Moby17176",
14601460
`testDevmapperLockReleasedDeviceDeletion_moby17176\.func1\(.* \[sync\.Mutex\.Lock\]`,
14611461
),
1462-
makeTest("Moby21233",
1462+
makeFlakyTest("Moby21233",
14631463
`\(\*Transfer_moby21233\)\.Watch\.func1\(.* \[chan send\]`,
14641464
`\(\*Transfer_moby21233\)\.Watch\.func1\(.* \[select\]`,
14651465
`testTransfer_moby21233\(.* \[chan receive\]`,
@@ -1541,6 +1541,8 @@ func TestGoroutineLeakGC(t *testing.T) {
15411541
t.Errorf("output:\n%s\n\ngoroutines leaks detected in case with no leaks", output)
15421542
}
15431543

1544+
unexpectedLeaks := make([]string, 0, len(foundLeaks))
1545+
15441546
// Parse every leak and check if it is expected (maybe as a flaky leak).
15451547
LEAKS:
15461548
for _, leak := range foundLeaks {
@@ -1575,7 +1577,7 @@ func TestGoroutineLeakGC(t *testing.T) {
15751577
}
15761578
}
15771579

1578-
t.Errorf("output:\n%s\n\nunexpected goroutine leak: %s", output, leak)
1580+
unexpectedLeaks = append(unexpectedLeaks, leak)
15791581
}
15801582
}
15811583

@@ -1586,8 +1588,15 @@ func TestGoroutineLeakGC(t *testing.T) {
15861588
}
15871589
}
15881590

1591+
var errors []error
1592+
if len(unexpectedLeaks) > 0 {
1593+
errors = append(errors, fmt.Errorf("unexpected goroutine leaks:\n%s", strings.Join(unexpectedLeaks, "\n")))
1594+
}
15891595
if len(missingLeakStrs) > 0 {
1590-
t.Fatalf("output:\n%s\n\nnot enough goroutines leaks detected. Missing:\n%s", output, strings.Join(missingLeakStrs, ", "))
1596+
errors = append(errors, fmt.Errorf("missing expected leaks:\n%s", strings.Join(missingLeakStrs, ", ")))
1597+
}
1598+
if len(errors) > 0 {
1599+
t.Fatalf("Failed with the following errors:\n%s\n\noutput:\n%s", errors, output)
15911600
}
15921601
})
15931602
}

0 commit comments

Comments
 (0)