@@ -861,6 +861,19 @@ func CacheTest(createCacheFunc func(config *rest.Config, opts cache.Options) (ca
861861 Expect (listObj .Items ).Should (HaveLen (1 ))
862862 })
863863
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+
864877 It ("should return an error if the continue list options is set" , func () {
865878 listObj := & corev1.PodList {}
866879 continueOpt := client .Continue ("token" )
@@ -1182,6 +1195,25 @@ func CacheTest(createCacheFunc func(config *rest.Config, opts cache.Options) (ca
11821195 Expect (nodeList .Items ).NotTo (BeEmpty ())
11831196 Expect (len (nodeList .Items )).To (BeEquivalentTo (2 ))
11841197 })
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+
11851217 It ("should return an error if the continue list options is set" , func () {
11861218 podList := & unstructured.Unstructured {}
11871219 continueOpt := client .Continue ("token" )
@@ -1511,6 +1543,24 @@ func CacheTest(createCacheFunc func(config *rest.Config, opts cache.Options) (ca
15111543 err := informerCache .Get (context .Background (), svcKey , svc )
15121544 Expect (err ).To (HaveOccurred ())
15131545 })
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+ })
15141564 })
15151565 type selectorsTestCase struct {
15161566 options cache.Options
0 commit comments