@@ -1414,13 +1414,13 @@ func TestGoroutineLeakGC(t *testing.T) {
1414
1414
`\(\*statusManager_kubernetes10182\)\.SetPodStatus\(.* \[chan send\]` ,
1415
1415
),
1416
1416
makeFlakyTest ("Kubernetes11298" ,
1417
- // This entire test is flaky in producing leaks. Run it only to check for crashes.
1418
1417
`After_kubernetes11298\.func1\(.* \[chan receive\]` ,
1419
1418
`After_kubernetes11298\.func1\(.* \[sync\.Cond\.Wait\]` ,
1420
1419
`Kubernetes11298\.func2\(.* \[chan receive\]` ,
1421
1420
),
1422
1421
makeFlakyTest ("Kubernetes13135" ,
1423
- `Kubernetes13135\.func2\(.* \[sync\.WaitGroup\.Wait\]` ,
1422
+ `Util_kubernetes13135\(.* \[sync\.Mutex\.Lock\]` ,
1423
+ `\(\*WatchCache_kubernetes13135\)\.Add\(.* \[sync\.Mutex\.Lock\]` ,
1424
1424
),
1425
1425
makeTest ("Kubernetes25331" ,
1426
1426
`\(\*watchChan_kubernetes25331\)\.run\(.* \[chan send\]` ,
@@ -1459,7 +1459,7 @@ func TestGoroutineLeakGC(t *testing.T) {
1459
1459
makeTest ("Moby17176" ,
1460
1460
`testDevmapperLockReleasedDeviceDeletion_moby17176\.func1\(.* \[sync\.Mutex\.Lock\]` ,
1461
1461
),
1462
- makeTest ("Moby21233" ,
1462
+ makeFlakyTest ("Moby21233" ,
1463
1463
`\(\*Transfer_moby21233\)\.Watch\.func1\(.* \[chan send\]` ,
1464
1464
`\(\*Transfer_moby21233\)\.Watch\.func1\(.* \[select\]` ,
1465
1465
`testTransfer_moby21233\(.* \[chan receive\]` ,
@@ -1541,6 +1541,8 @@ func TestGoroutineLeakGC(t *testing.T) {
1541
1541
t .Errorf ("output:\n %s\n \n goroutines leaks detected in case with no leaks" , output )
1542
1542
}
1543
1543
1544
+ unexpectedLeaks := make ([]string , 0 , len (foundLeaks ))
1545
+
1544
1546
// Parse every leak and check if it is expected (maybe as a flaky leak).
1545
1547
LEAKS:
1546
1548
for _ , leak := range foundLeaks {
@@ -1575,7 +1577,7 @@ func TestGoroutineLeakGC(t *testing.T) {
1575
1577
}
1576
1578
}
1577
1579
1578
- t . Errorf ( "output: \n %s \n \n unexpected goroutine leak: %s" , output , leak )
1580
+ unexpectedLeaks = append ( unexpectedLeaks , leak )
1579
1581
}
1580
1582
}
1581
1583
@@ -1586,8 +1588,15 @@ func TestGoroutineLeakGC(t *testing.T) {
1586
1588
}
1587
1589
}
1588
1590
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
+ }
1589
1595
if len (missingLeakStrs ) > 0 {
1590
- t .Fatalf ("output:\n %s\n \n not 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 \n output:\n %s" , errors , output )
1591
1600
}
1592
1601
})
1593
1602
}
0 commit comments