@@ -124,7 +124,7 @@ var _ = Describe("Informer Cache", func() {
124124 It ("should be able to list objects that haven't been watched previously" , func () {
125125 By ("listing all services in the cluster" )
126126 listObj := & kcorev1.ServiceList {}
127- Expect (informerCache .List (context .Background (), nil , listObj )).To (Succeed ())
127+ Expect (informerCache .List (context .Background (), listObj )).To (Succeed ())
128128
129129 By ("verifying that the returned list contains the Kubernetes service" )
130130 // NB: kubernetes default service is automatically created in testenv.
@@ -154,10 +154,9 @@ var _ = Describe("Informer Cache", func() {
154154 By ("listing pods with a particular label" )
155155 // NB: each pod has a "test-label": <pod-name>
156156 out := kcorev1.PodList {}
157- lo := & client.ListOptions {}
158- lo .InNamespace (testNamespaceTwo )
159- lo .MatchingLabels (map [string ]string {"test-label" : "test-pod-2" })
160- Expect (informerCache .List (context .Background (), lo , & out )).To (Succeed ())
157+ Expect (informerCache .List (context .Background (), & out ,
158+ client .InNamespace (testNamespaceTwo ),
159+ client .MatchingLabels (map [string ]string {"test-label" : "test-pod-2" }))).To (Succeed ())
161160
162161 By ("verifying the returned pods have the correct label" )
163162 Expect (out .Items ).NotTo (BeEmpty ())
@@ -174,9 +173,7 @@ var _ = Describe("Informer Cache", func() {
174173 // NB: each pod has a "test-label": <pod-name>
175174 out := kcorev1.PodList {}
176175 labels := map [string ]string {"test-label" : "test-pod-2" }
177- lo := & client.ListOptions {}
178- lo .MatchingLabels (labels )
179- Expect (informerCache .List (context .Background (), lo , & out )).To (Succeed ())
176+ Expect (informerCache .List (context .Background (), & out , client .MatchingLabels (labels ))).To (Succeed ())
180177
181178 By ("verifying multiple pods with the same label in different namespaces are returned" )
182179 Expect (out .Items ).NotTo (BeEmpty ())
@@ -191,9 +188,8 @@ var _ = Describe("Informer Cache", func() {
191188 It ("should be able to list objects by namespace" , func () {
192189 By ("listing pods in test-namespace-1" )
193190 listObj := & kcorev1.PodList {}
194- lo := & client.ListOptions {}
195- lo .InNamespace (testNamespaceOne )
196- Expect (informerCache .List (context .Background (), lo , listObj )).To (Succeed ())
191+ Expect (informerCache .List (context .Background (), listObj ,
192+ client .InNamespace (testNamespaceOne ))).To (Succeed ())
197193
198194 By ("verifying that the returned pods are in test-namespace-1" )
199195 Expect (listObj .Items ).NotTo (BeEmpty ())
@@ -216,7 +212,7 @@ var _ = Describe("Informer Cache", func() {
216212
217213 By ("listing pods in all namespaces" )
218214 out := & kcorev1.PodList {}
219- Expect (namespacedCache .List (context .Background (), nil , out )).To (Succeed ())
215+ Expect (namespacedCache .List (context .Background (), out )).To (Succeed ())
220216
221217 By ("verifying the returned pod is from the watched namespace" )
222218 Expect (out .Items ).NotTo (BeEmpty ())
@@ -225,7 +221,7 @@ var _ = Describe("Informer Cache", func() {
225221
226222 By ("listing all namespaces - should still be able to get a cluster-scoped resource" )
227223 namespaceList := & kcorev1.NamespaceList {}
228- Expect (namespacedCache .List (context .Background (), nil , namespaceList )).To (Succeed ())
224+ Expect (namespacedCache .List (context .Background (), namespaceList )).To (Succeed ())
229225
230226 By ("verifying the namespace list is not empty" )
231227 Expect (namespaceList .Items ).NotTo (BeEmpty ())
@@ -267,7 +263,7 @@ var _ = Describe("Informer Cache", func() {
267263 Version : "v1" ,
268264 Kind : "ServiceList" ,
269265 })
270- err := informerCache .List (context .Background (), nil , listObj )
266+ err := informerCache .List (context .Background (), listObj )
271267 Expect (err ).To (Succeed ())
272268
273269 By ("verifying that the returned list contains the Kubernetes service" )
@@ -308,10 +304,9 @@ var _ = Describe("Informer Cache", func() {
308304 Version : "v1" ,
309305 Kind : "PodList" ,
310306 })
311- lo := & client.ListOptions {}
312- lo .InNamespace (testNamespaceTwo )
313- lo .MatchingLabels (map [string ]string {"test-label" : "test-pod-2" })
314- err := informerCache .List (context .Background (), lo , & out )
307+ err := informerCache .List (context .Background (), & out ,
308+ client .InNamespace (testNamespaceTwo ),
309+ client .MatchingLabels (map [string ]string {"test-label" : "test-pod-2" }))
315310 Expect (err ).To (Succeed ())
316311
317312 By ("verifying the returned pods have the correct label" )
@@ -334,9 +329,7 @@ var _ = Describe("Informer Cache", func() {
334329 Kind : "PodList" ,
335330 })
336331 labels := map [string ]string {"test-label" : "test-pod-2" }
337- lo := & client.ListOptions {}
338- lo .MatchingLabels (labels )
339- err := informerCache .List (context .Background (), lo , & out )
332+ err := informerCache .List (context .Background (), & out , client .MatchingLabels (labels ))
340333 Expect (err ).To (Succeed ())
341334
342335 By ("verifying multiple pods with the same label in different namespaces are returned" )
@@ -357,9 +350,7 @@ var _ = Describe("Informer Cache", func() {
357350 Version : "v1" ,
358351 Kind : "PodList" ,
359352 })
360- lo := & client.ListOptions {}
361- lo .InNamespace (testNamespaceOne )
362- err := informerCache .List (context .Background (), lo , listObj )
353+ err := informerCache .List (context .Background (), listObj , client .InNamespace (testNamespaceOne ))
363354 Expect (err ).To (Succeed ())
364355
365356 By ("verifying that the returned pods are in test-namespace-1" )
@@ -388,7 +379,7 @@ var _ = Describe("Informer Cache", func() {
388379 Version : "v1" ,
389380 Kind : "PodList" ,
390381 })
391- Expect (namespacedCache .List (context .Background (), nil , out )).To (Succeed ())
382+ Expect (namespacedCache .List (context .Background (), out )).To (Succeed ())
392383
393384 By ("verifying the returned pod is from the watched namespace" )
394385 Expect (out .Items ).NotTo (BeEmpty ())
@@ -402,7 +393,7 @@ var _ = Describe("Informer Cache", func() {
402393 Version : "v1" ,
403394 Kind : "NamespaceList" ,
404395 })
405- Expect (namespacedCache .List (context .Background (), nil , namespaceList )).To (Succeed ())
396+ Expect (namespacedCache .List (context .Background (), namespaceList )).To (Succeed ())
406397
407398 By ("verifying the namespace list is not empty" )
408399 Expect (namespaceList .Items ).NotTo (BeEmpty ())
@@ -552,9 +543,8 @@ var _ = Describe("Informer Cache", func() {
552543
553544 By ("listing Pods with restartPolicyOnFailure" )
554545 listObj := & kcorev1.PodList {}
555- lo := & client.ListOptions {}
556- lo .MatchingField ("spec.restartPolicy" , "OnFailure" )
557- Expect (informer .List (context .Background (), lo , listObj )).To (Succeed ())
546+ Expect (informer .List (context .Background (), listObj ,
547+ client .MatchingField ("spec.restartPolicy" , "OnFailure" ))).To (Succeed ())
558548
559549 By ("verifying that the returned pods have correct restart policy" )
560550 Expect (listObj .Items ).NotTo (BeEmpty ())
@@ -647,9 +637,8 @@ var _ = Describe("Informer Cache", func() {
647637 Version : "v1" ,
648638 Kind : "PodList" ,
649639 })
650- lo := & client.ListOptions {}
651- lo .MatchingField ("spec.restartPolicy" , "OnFailure" )
652- err = informer .List (context .Background (), lo , listObj )
640+ err = informer .List (context .Background (), listObj ,
641+ client .MatchingField ("spec.restartPolicy" , "OnFailure" ))
653642 Expect (err ).To (Succeed ())
654643
655644 By ("verifying that the returned pods have correct restart policy" )
0 commit comments