@@ -193,7 +193,7 @@ var _ = Describe("Cache with transformers", func() {
193
193
Expect (obj ).NotTo (BeNil ())
194
194
195
195
accessor , err := meta .Accessor (obj )
196
- Expect (err ).To ( BeNil ())
196
+ Expect (err ).ToNot ( HaveOccurred ())
197
197
annotations := accessor .GetAnnotations ()
198
198
199
199
if _ , exists := annotations ["transformed" ]; exists {
@@ -214,7 +214,7 @@ var _ = Describe("Cache with transformers", func() {
214
214
obj := i .(runtime.Object )
215
215
Expect (obj ).NotTo (BeNil ())
216
216
accessor , err := meta .Accessor (obj )
217
- Expect (err ).To ( BeNil ())
217
+ Expect (err ).ToNot ( HaveOccurred ())
218
218
219
219
annotations := accessor .GetAnnotations ()
220
220
if _ , exists := annotations ["transformed" ]; exists {
@@ -401,15 +401,15 @@ var _ = Describe("Cache with selectors", func() {
401
401
var sas corev1.ServiceAccountList
402
402
err := informerCache .List (informerCacheCtx , & sas )
403
403
Expect (err ).NotTo (HaveOccurred ())
404
- Expect (len ( sas .Items )) .To (Equal (1 ))
404
+ Expect (sas .Items ).To (HaveLen (1 ))
405
405
Expect (sas .Items [0 ].Namespace ).To (Equal (testNamespaceOne ))
406
406
})
407
407
408
408
It ("Should list services and find exactly one in namespace " + testNamespaceTwo , func () {
409
409
var svcs corev1.ServiceList
410
410
err := informerCache .List (informerCacheCtx , & svcs )
411
411
Expect (err ).NotTo (HaveOccurred ())
412
- Expect (len ( svcs .Items )) .To (Equal (1 ))
412
+ Expect (svcs .Items ).To (HaveLen (1 ))
413
413
Expect (svcs .Items [0 ].Namespace ).To (Equal (testNamespaceTwo ))
414
414
})
415
415
})
@@ -618,7 +618,7 @@ func CacheTest(createCacheFunc func(config *rest.Config, opts cache.Options) (ca
618
618
Expect (informerCache .List (context .Background (), outList2 , client .InNamespace (testNamespaceOne ))).To (Succeed ())
619
619
620
620
By ("verifying the pointer fields in pod have the same addresses" )
621
- Expect (len ( outList1 .Items )) .To (Equal (len (outList2 .Items )))
621
+ Expect (outList1 .Items ).To (HaveLen (len (outList2 .Items )))
622
622
sort .SliceStable (outList1 .Items , func (i , j int ) bool { return outList1 .Items [i ].Name <= outList1 .Items [j ].Name })
623
623
sort .SliceStable (outList2 .Items , func (i , j int ) bool { return outList2 .Items [i ].Name <= outList2 .Items [j ].Name })
624
624
for i := range outList1 .Items {
@@ -798,7 +798,7 @@ func CacheTest(createCacheFunc func(config *rest.Config, opts cache.Options) (ca
798
798
defer GinkgoRecover ()
799
799
Expect (namespacedCache .Start (informerCacheCtx )).To (Succeed ())
800
800
}()
801
- Expect (namespacedCache .WaitForCacheSync (informerCacheCtx )).NotTo ( BeFalse ())
801
+ Expect (namespacedCache .WaitForCacheSync (informerCacheCtx )).To ( BeTrue ())
802
802
803
803
By ("listing pods in all namespaces" )
804
804
out := & unstructured.UnstructuredList {}
@@ -893,7 +893,7 @@ func CacheTest(createCacheFunc func(config *rest.Config, opts cache.Options) (ca
893
893
Expect (informerCache .List (context .Background (), outList2 , client .InNamespace (testNamespaceOne ))).To (Succeed ())
894
894
895
895
By ("verifying the pointer fields in pod have the same addresses" )
896
- Expect (len ( outList1 .Items )) .To (Equal (len (outList2 .Items )))
896
+ Expect (outList1 .Items ).To (HaveLen (len (outList2 .Items )))
897
897
sort .SliceStable (outList1 .Items , func (i , j int ) bool { return outList1 .Items [i ].GetName () <= outList1 .Items [j ].GetName () })
898
898
sort .SliceStable (outList2 .Items , func (i , j int ) bool { return outList2 .Items [i ].GetName () <= outList2 .Items [j ].GetName () })
899
899
for i := range outList1 .Items {
@@ -940,7 +940,7 @@ func CacheTest(createCacheFunc func(config *rest.Config, opts cache.Options) (ca
940
940
defer GinkgoRecover ()
941
941
Expect (m .Start (informerCacheCtx )).To (Succeed ())
942
942
}()
943
- Expect (m .WaitForCacheSync (informerCacheCtx )).NotTo ( BeFalse ())
943
+ Expect (m .WaitForCacheSync (informerCacheCtx )).To ( BeTrue ())
944
944
945
945
By ("should be able to fetch cluster scoped resource" )
946
946
node := & corev1.Node {}
@@ -1079,7 +1079,7 @@ func CacheTest(createCacheFunc func(config *rest.Config, opts cache.Options) (ca
1079
1079
defer GinkgoRecover ()
1080
1080
Expect (namespacedCache .Start (informerCacheCtx )).To (Succeed ())
1081
1081
}()
1082
- Expect (namespacedCache .WaitForCacheSync (informerCacheCtx )).NotTo ( BeFalse ())
1082
+ Expect (namespacedCache .WaitForCacheSync (informerCacheCtx )).To ( BeTrue ())
1083
1083
1084
1084
By ("listing pods in all namespaces" )
1085
1085
out := & metav1.PartialObjectMetadataList {}
@@ -1179,7 +1179,7 @@ func CacheTest(createCacheFunc func(config *rest.Config, opts cache.Options) (ca
1179
1179
Expect (informerCache .List (context .Background (), outList2 , client .InNamespace (testNamespaceOne ))).To (Succeed ())
1180
1180
1181
1181
By ("verifying the pointer fields in pod have the same addresses" )
1182
- Expect (len ( outList1 .Items )) .To (Equal (len (outList2 .Items )))
1182
+ Expect (outList1 .Items ).To (HaveLen (len (outList2 .Items )))
1183
1183
sort .SliceStable (outList1 .Items , func (i , j int ) bool { return outList1 .Items [i ].Name <= outList1 .Items [j ].Name })
1184
1184
sort .SliceStable (outList2 .Items , func (i , j int ) bool { return outList2 .Items [i ].Name <= outList2 .Items [j ].Name })
1185
1185
for i := range outList1 .Items {
@@ -1238,7 +1238,7 @@ func CacheTest(createCacheFunc func(config *rest.Config, opts cache.Options) (ca
1238
1238
defer GinkgoRecover ()
1239
1239
Expect (informer .Start (informerCacheCtx )).To (Succeed ())
1240
1240
}()
1241
- Expect (informer .WaitForCacheSync (informerCacheCtx )).NotTo ( BeFalse ())
1241
+ Expect (informer .WaitForCacheSync (informerCacheCtx )).To ( BeTrue ())
1242
1242
1243
1243
By ("Checking with structured" )
1244
1244
obtainedStructuredPodList := corev1.PodList {}
@@ -1415,7 +1415,7 @@ func CacheTest(createCacheFunc func(config *rest.Config, opts cache.Options) (ca
1415
1415
defer GinkgoRecover ()
1416
1416
Expect (informer .Start (informerCacheCtx )).To (Succeed ())
1417
1417
}()
1418
- Expect (informer .WaitForCacheSync (informerCacheCtx )).NotTo ( BeFalse ())
1418
+ Expect (informer .WaitForCacheSync (informerCacheCtx )).To ( BeTrue ())
1419
1419
1420
1420
By ("listing Pods with restartPolicyOnFailure" )
1421
1421
listObj := & corev1.PodList {}
@@ -1484,7 +1484,7 @@ func CacheTest(createCacheFunc func(config *rest.Config, opts cache.Options) (ca
1484
1484
defer GinkgoRecover ()
1485
1485
Expect (informer .Start (informerCacheCtx )).To (Succeed ())
1486
1486
}()
1487
- Expect (informer .WaitForCacheSync (informerCacheCtx )).NotTo ( BeFalse ())
1487
+ Expect (informer .WaitForCacheSync (informerCacheCtx )).To ( BeTrue ())
1488
1488
1489
1489
By ("listing Namespaces with fixed indexer" )
1490
1490
listObj := & corev1.NamespaceList {}
@@ -1574,7 +1574,7 @@ func CacheTest(createCacheFunc func(config *rest.Config, opts cache.Options) (ca
1574
1574
defer GinkgoRecover ()
1575
1575
Expect (informer .Start (informerCacheCtx )).To (Succeed ())
1576
1576
}()
1577
- Expect (informer .WaitForCacheSync (informerCacheCtx )).NotTo ( BeFalse ())
1577
+ Expect (informer .WaitForCacheSync (informerCacheCtx )).To ( BeTrue ())
1578
1578
1579
1579
By ("listing Pods with restartPolicyOnFailure" )
1580
1580
listObj := & unstructured.UnstructuredList {}
@@ -1687,7 +1687,7 @@ func CacheTest(createCacheFunc func(config *rest.Config, opts cache.Options) (ca
1687
1687
defer GinkgoRecover ()
1688
1688
Expect (informer .Start (informerCacheCtx )).To (Succeed ())
1689
1689
}()
1690
- Expect (informer .WaitForCacheSync (informerCacheCtx )).NotTo ( BeFalse ())
1690
+ Expect (informer .WaitForCacheSync (informerCacheCtx )).To ( BeTrue ())
1691
1691
1692
1692
By ("listing Pods with restartPolicyOnFailure" )
1693
1693
listObj := & metav1.PartialObjectMetadataList {}
0 commit comments