mirror of
https://github.com/kubernetes/client-go.git
synced 2025-09-06 01:20:40 +00:00
client-go/tools/cache: goroutine leak checking
Several tests leaked goroutines. All of those get fixed where possible without API changes. Goleak is used to prevent regressions. One new test specifically covers shutdown of an informer and its event handlers. Kubernetes-commit: 0ba43734b4c8998b4aaeb1fa2bec8dee609fa50a
This commit is contained in:
committed by
Kubernetes Publisher
parent
67da6d1a41
commit
b836a27b07
21
tools/cache/main_test.go
vendored
21
tools/cache/main_test.go
vendored
@@ -17,10 +17,27 @@ limitations under the License.
|
||||
package cache
|
||||
|
||||
import (
|
||||
"os"
|
||||
"testing"
|
||||
|
||||
"go.uber.org/goleak"
|
||||
)
|
||||
|
||||
func TestMain(m *testing.M) {
|
||||
os.Exit(m.Run())
|
||||
options := []goleak.Option{
|
||||
// These tests run goroutines which get stuck in Pop.
|
||||
// This cannot be fixed without modifying the API.
|
||||
goleak.IgnoreAnyFunction("k8s.io/client-go/tools/cache.TestFIFO_addReplace.func1"),
|
||||
goleak.IgnoreAnyFunction("k8s.io/client-go/tools/cache.TestFIFO_addUpdate.func1"),
|
||||
goleak.IgnoreAnyFunction("k8s.io/client-go/tools/cache.TestDeltaFIFO_addReplace.func1"),
|
||||
goleak.IgnoreAnyFunction("k8s.io/client-go/tools/cache.TestDeltaFIFO_addUpdate.func1"),
|
||||
|
||||
// TODO: fix the following tests by adding WithContext APIs and cancellation.
|
||||
goleak.IgnoreAnyFunction("k8s.io/client-go/tools/cache.TestTransformingInformerRace.func3"),
|
||||
// Created by k8s.io/client-go/tools/cache.TestReflectorListAndWatch, cannot filter on that (https://github.com/uber-go/goleak/issues/135):
|
||||
goleak.IgnoreAnyFunction("k8s.io/client-go/tools/cache.(*Reflector).ListAndWatch"),
|
||||
goleak.IgnoreAnyFunction("k8s.io/client-go/tools/cache.(*Reflector).startResync"),
|
||||
// ???
|
||||
goleak.IgnoreAnyFunction("k8s.io/client-go/tools/cache.(*DeltaFIFO).Close"),
|
||||
}
|
||||
goleak.VerifyTestMain(m, options...)
|
||||
}
|
||||
|
Reference in New Issue
Block a user