@@ -861,6 +861,19 @@ func CacheTest(createCacheFunc func(config *rest.Config, opts cache.Options) (ca
861
861
Expect (listObj .Items ).Should (HaveLen (1 ))
862
862
})
863
863
864
+ It ("should return an error if pagination is used" , func () {
865
+ listObj := & corev1.PodList {}
866
+ By ("verifying that the first list works and returns a sentinel continue" )
867
+ err := informerCache .List (context .Background (), listObj )
868
+ Expect (err ).ToNot (HaveOccurred ())
869
+ Expect (listObj .Continue ).To (Equal ("continue-not-supported" ))
870
+
871
+ By ("verifying that an error is returned" )
872
+ err = informerCache .List (context .Background (), listObj , client .Continue (listObj .Continue ))
873
+ Expect (err ).To (HaveOccurred ())
874
+ Expect (err .Error ()).To (Equal ("continue list option is not supported by the cache" ))
875
+ })
876
+
864
877
It ("should return an error if the continue list options is set" , func () {
865
878
listObj := & corev1.PodList {}
866
879
continueOpt := client .Continue ("token" )
@@ -1182,6 +1195,25 @@ func CacheTest(createCacheFunc func(config *rest.Config, opts cache.Options) (ca
1182
1195
Expect (nodeList .Items ).NotTo (BeEmpty ())
1183
1196
Expect (len (nodeList .Items )).To (BeEquivalentTo (2 ))
1184
1197
})
1198
+
1199
+ It ("should return an error if pagination is used" , func () {
1200
+ nodeList := & unstructured.UnstructuredList {}
1201
+ nodeList .SetGroupVersionKind (schema.GroupVersionKind {
1202
+ Group : "" ,
1203
+ Version : "v1" ,
1204
+ Kind : "NodeList" ,
1205
+ })
1206
+ By ("verifying that the first list works and returns a sentinel continue" )
1207
+ err := informerCache .List (context .Background (), nodeList )
1208
+ Expect (err ).ToNot (HaveOccurred ())
1209
+ Expect (nodeList .GetContinue ()).To (Equal ("continue-not-supported" ))
1210
+
1211
+ By ("verifying that an error is returned" )
1212
+ err = informerCache .List (context .Background (), nodeList , client .Continue (nodeList .GetContinue ()))
1213
+ Expect (err ).To (HaveOccurred ())
1214
+ Expect (err .Error ()).To (Equal ("continue list option is not supported by the cache" ))
1215
+ })
1216
+
1185
1217
It ("should return an error if the continue list options is set" , func () {
1186
1218
podList := & unstructured.Unstructured {}
1187
1219
continueOpt := client .Continue ("token" )
@@ -1511,6 +1543,24 @@ func CacheTest(createCacheFunc func(config *rest.Config, opts cache.Options) (ca
1511
1543
err := informerCache .Get (context .Background (), svcKey , svc )
1512
1544
Expect (err ).To (HaveOccurred ())
1513
1545
})
1546
+
1547
+ It ("should return an error if pagination is used" , func () {
1548
+ nodeList := & metav1.PartialObjectMetadataList {}
1549
+ nodeList .SetGroupVersionKind (schema.GroupVersionKind {
1550
+ Group : "" ,
1551
+ Version : "v1" ,
1552
+ Kind : "NodeList" ,
1553
+ })
1554
+ By ("verifying that the first list works and returns a sentinel continue" )
1555
+ err := informerCache .List (context .Background (), nodeList )
1556
+ Expect (err ).ToNot (HaveOccurred ())
1557
+ Expect (nodeList .GetContinue ()).To (Equal ("continue-not-supported" ))
1558
+
1559
+ By ("verifying that an error is returned" )
1560
+ err = informerCache .List (context .Background (), nodeList , client .Continue (nodeList .GetContinue ()))
1561
+ Expect (err ).To (HaveOccurred ())
1562
+ Expect (err .Error ()).To (Equal ("continue list option is not supported by the cache" ))
1563
+ })
1514
1564
})
1515
1565
type selectorsTestCase struct {
1516
1566
options cache.Options
0 commit comments