@@ -66,7 +66,6 @@ var _ = Describe("controller", func() {
66
66
MaxConcurrentReconciles : 1 ,
67
67
Do : fakeReconcile ,
68
68
MakeQueue : func () workqueue.RateLimitingInterface { return queue },
69
- Cache : informers ,
70
69
}
71
70
Expect (ctrl .InjectFunc (func (interface {}) error { return nil })).To (Succeed ())
72
71
})
@@ -89,7 +88,10 @@ var _ = Describe("controller", func() {
89
88
90
89
Describe ("Start" , func () {
91
90
It ("should return an error if there is an error waiting for the informers" , func (done Done ) {
92
- ctrl .WaitForCacheSync = func (<- chan struct {}) bool { return false }
91
+ f := false
92
+ ctrl .watches = []watchDescription {{
93
+ src : source .NewKindWithCache (& corev1.Pod {}, & informertest.FakeInformers {Synced : & f }),
94
+ }}
93
95
ctrl .Name = "foo"
94
96
err := ctrl .Start (stop )
95
97
Expect (err ).To (HaveOccurred ())
@@ -111,8 +113,9 @@ var _ = Describe("controller", func() {
111
113
Expect (err ).NotTo (HaveOccurred ())
112
114
_ , err = c .GetInformer (context .TODO (), & appsv1.ReplicaSet {})
113
115
Expect (err ).NotTo (HaveOccurred ())
114
- ctrl .Cache = c
115
- ctrl .WaitForCacheSync = func (<- chan struct {}) bool { return true }
116
+ ctrl .watches = []watchDescription {{
117
+ src : source .NewKindWithCache (& appsv1.Deployment {}, & informertest.FakeInformers {}),
118
+ }}
116
119
117
120
Expect (ctrl .Start (stopped )).NotTo (HaveOccurred ())
118
121
@@ -162,7 +165,7 @@ var _ = Describe("controller", func() {
162
165
Describe ("Watch" , func () {
163
166
It ("should inject dependencies into the Source" , func () {
164
167
src := & source.Kind {Type : & corev1.Pod {}}
165
- Expect (src .InjectCache (ctrl . Cache )).To (Succeed ())
168
+ Expect (src .InjectCache (informers )).To (Succeed ())
166
169
evthdl := & handler.EnqueueRequestForObject {}
167
170
found := false
168
171
ctrl .SetFields = func (i interface {}) error {
@@ -178,7 +181,7 @@ var _ = Describe("controller", func() {
178
181
179
182
It ("should return an error if there is an error injecting into the Source" , func () {
180
183
src := & source.Kind {Type : & corev1.Pod {}}
181
- Expect (src .InjectCache (ctrl . Cache )).To (Succeed ())
184
+ Expect (src .InjectCache (informers )).To (Succeed ())
182
185
evthdl := & handler.EnqueueRequestForObject {}
183
186
expected := fmt .Errorf ("expect fail source" )
184
187
ctrl .SetFields = func (i interface {}) error {
@@ -193,7 +196,7 @@ var _ = Describe("controller", func() {
193
196
194
197
It ("should inject dependencies into the EventHandler" , func () {
195
198
src := & source.Kind {Type : & corev1.Pod {}}
196
- Expect (src .InjectCache (ctrl . Cache )).To (Succeed ())
199
+ Expect (src .InjectCache (informers )).To (Succeed ())
197
200
evthdl := & handler.EnqueueRequestForObject {}
198
201
found := false
199
202
ctrl .SetFields = func (i interface {}) error {
@@ -231,7 +234,7 @@ var _ = Describe("controller", func() {
231
234
232
235
It ("should inject dependencies into all of the Predicates" , func () {
233
236
src := & source.Kind {Type : & corev1.Pod {}}
234
- Expect (src .InjectCache (ctrl . Cache )).To (Succeed ())
237
+ Expect (src .InjectCache (informers )).To (Succeed ())
235
238
evthdl := & handler.EnqueueRequestForObject {}
236
239
pr1 := & predicate.Funcs {}
237
240
pr2 := & predicate.Funcs {}
@@ -254,7 +257,7 @@ var _ = Describe("controller", func() {
254
257
255
258
It ("should return an error if there is an error injecting into any of the Predicates" , func () {
256
259
src := & source.Kind {Type : & corev1.Pod {}}
257
- Expect (src .InjectCache (ctrl . Cache )).To (Succeed ())
260
+ Expect (src .InjectCache (informers )).To (Succeed ())
258
261
evthdl := & handler.EnqueueRequestForObject {}
259
262
pr1 := & predicate.Funcs {}
260
263
pr2 := & predicate.Funcs {}
0 commit comments