@@ -157,6 +157,8 @@ var _ = Describe("Fake client", func() {
157157 list .SetKind ("DeploymentList" )
158158 err := cl .List (context .Background (), list , client .InNamespace ("ns1" ))
159159 Expect (err ).ToNot (HaveOccurred ())
160+ Expect (list .GroupVersionKind ().GroupVersion ().String ()).To (Equal ("apps/v1" ))
161+ Expect (list .GetKind ()).To (Equal ("DeploymentList" ))
160162 Expect (list .Items ).To (HaveLen (2 ))
161163 })
162164
@@ -167,6 +169,8 @@ var _ = Describe("Fake client", func() {
167169 list .SetKind ("Deployment" )
168170 err := cl .List (context .Background (), list , client .InNamespace ("ns1" ))
169171 Expect (err ).ToNot (HaveOccurred ())
172+ Expect (list .GroupVersionKind ().GroupVersion ().String ()).To (Equal ("apps/v1" ))
173+ Expect (list .GetKind ()).To (Equal ("Deployment" ))
170174 Expect (list .Items ).To (HaveLen (2 ))
171175 })
172176
@@ -178,6 +182,8 @@ var _ = Describe("Fake client", func() {
178182 list .SetKind ("EndpointsList" )
179183 err := cl .List (context .Background (), list , client .InNamespace ("ns1" ))
180184 Expect (err ).ToNot (HaveOccurred ())
185+ Expect (list .GroupVersionKind ().GroupVersion ().String ()).To (Equal ("v1" ))
186+ Expect (list .GetKind ()).To (Equal ("EndpointsList" ))
181187 Expect (list .Items ).To (HaveLen (1 ))
182188 }
183189
@@ -247,6 +253,8 @@ var _ = Describe("Fake client", func() {
247253 list .SetAPIVersion ("custom/v3" )
248254 list .SetKind ("ImageList" )
249255 err := cl .List (context .Background (), list )
256+ Expect (list .GroupVersionKind ().GroupVersion ().String ()).To (Equal ("custom/v3" ))
257+ Expect (list .GetKind ()).To (Equal ("ImageList" ))
250258 Expect (err ).ToNot (HaveOccurred ())
251259 })
252260
@@ -255,6 +263,8 @@ var _ = Describe("Fake client", func() {
255263 list .SetAPIVersion ("custom/v4" )
256264 list .SetKind ("Image" )
257265 err := cl .List (context .Background (), list )
266+ Expect (list .GroupVersionKind ().GroupVersion ().String ()).To (Equal ("custom/v4" ))
267+ Expect (list .GetKind ()).To (Equal ("Image" ))
258268 Expect (err ).ToNot (HaveOccurred ())
259269 })
260270
@@ -1325,6 +1335,20 @@ var _ = Describe("Fake client", func() {
13251335 Expect (list .Items ).To (BeEmpty ())
13261336 })
13271337
1338+ It ("errors when there's no Index for the GroupVersionResource with UnstructuredList" , func () {
1339+ listOpts := & client.ListOptions {
1340+ FieldSelector : fields .OneTermEqualSelector ("key" , "val" ),
1341+ }
1342+ list := & unstructured.UnstructuredList {}
1343+ list .SetAPIVersion ("v1" )
1344+ list .SetKind ("ConfigMapList" )
1345+ err := cl .List (context .Background (), list , listOpts )
1346+ Expect (err ).To (HaveOccurred ())
1347+ Expect (list .GroupVersionKind ().GroupVersion ().String ()).To (Equal ("v1" ))
1348+ Expect (list .GetKind ()).To (Equal ("ConfigMapList" ))
1349+ Expect (list .Items ).To (BeEmpty ())
1350+ })
1351+
13281352 It ("errors when there's no Index matching the field name" , func () {
13291353 listOpts := & client.ListOptions {
13301354 FieldSelector : fields .OneTermEqualSelector ("spec.paused" , "false" ),
0 commit comments