Add new watchers to PV controller tests

Add fake Pod and Node watchers to the tests. It only reduces test noise:

Failed to watch *v1.Pod: unhandled watch: testing.WatchActionImpl{ActionImpl:testing.ActionImpl{Namespace:"", Verb:"watch", Resource:schema.GroupVersionResource{Group:"", Version:"v1", Resource:"pods"}, Subresource:""}, WatchRestrictions:testing.WatchRestrictions{Labels:labels.internalSelector(nil), Fields:fields.andTerm{}, ResourceVersion:""}}
This commit is contained in:
Jan Safranek 2021-12-21 15:36:34 +01:00
parent a8cb4e22bf
commit e323306ce0

View File

@ -324,6 +324,8 @@ func TestControllerSync(t *testing.T) {
fakeClaimWatch := watch.NewFake()
client.PrependWatchReactor("persistentvolumeclaims", core.DefaultWatchReactor(fakeClaimWatch, nil))
client.PrependWatchReactor("storageclasses", core.DefaultWatchReactor(watch.NewFake(), nil))
client.PrependWatchReactor("nodes", core.DefaultWatchReactor(watch.NewFake(), nil))
client.PrependWatchReactor("pods", core.DefaultWatchReactor(watch.NewFake(), nil))
informers := informers.NewSharedInformerFactory(client, controller.NoResyncPeriodFunc())
ctrl, err := newTestController(client, informers, true)