Clean shutdown of endpoints/endpointslice integration tests
This commit is contained in:
@@ -28,9 +28,11 @@ import (
|
||||
"k8s.io/apimachinery/pkg/util/wait"
|
||||
"k8s.io/client-go/informers"
|
||||
"k8s.io/client-go/kubernetes/fake"
|
||||
v1core "k8s.io/client-go/kubernetes/typed/core/v1"
|
||||
"k8s.io/client-go/tools/cache"
|
||||
"k8s.io/client-go/tools/leaderelection/resourcelock"
|
||||
|
||||
"k8s.io/klog/v2"
|
||||
"k8s.io/kubernetes/pkg/controller"
|
||||
)
|
||||
|
||||
@@ -58,6 +60,11 @@ func newController(batchPeriod time.Duration) (*fake.Clientset, *endpointSliceMi
|
||||
client,
|
||||
batchPeriod)
|
||||
|
||||
// The event processing pipeline is normally started via Run() method.
|
||||
// However, since we don't start it in unit tests, we explicitly start it here.
|
||||
esController.eventBroadcaster.StartLogging(klog.Infof)
|
||||
esController.eventBroadcaster.StartRecordingToSink(&v1core.EventSinkImpl{Interface: client.CoreV1().Events("")})
|
||||
|
||||
esController.endpointsSynced = alwaysReady
|
||||
esController.endpointSlicesSynced = alwaysReady
|
||||
esController.servicesSynced = alwaysReady
|
||||
|
Reference in New Issue
Block a user