@@ -157,6 +157,8 @@ var _ = Describe("Fake client", func() {
157
157
list .SetKind ("DeploymentList" )
158
158
err := cl .List (context .Background (), list , client .InNamespace ("ns1" ))
159
159
Expect (err ).ToNot (HaveOccurred ())
160
+ Expect (list .GroupVersionKind ().GroupVersion ().String ()).To (Equal ("apps/v1" ))
161
+ Expect (list .GetKind ()).To (Equal ("DeploymentList" ))
160
162
Expect (list .Items ).To (HaveLen (2 ))
161
163
})
162
164
@@ -167,6 +169,8 @@ var _ = Describe("Fake client", func() {
167
169
list .SetKind ("Deployment" )
168
170
err := cl .List (context .Background (), list , client .InNamespace ("ns1" ))
169
171
Expect (err ).ToNot (HaveOccurred ())
172
+ Expect (list .GroupVersionKind ().GroupVersion ().String ()).To (Equal ("apps/v1" ))
173
+ Expect (list .GetKind ()).To (Equal ("Deployment" ))
170
174
Expect (list .Items ).To (HaveLen (2 ))
171
175
})
172
176
@@ -178,6 +182,8 @@ var _ = Describe("Fake client", func() {
178
182
list .SetKind ("EndpointsList" )
179
183
err := cl .List (context .Background (), list , client .InNamespace ("ns1" ))
180
184
Expect (err ).ToNot (HaveOccurred ())
185
+ Expect (list .GroupVersionKind ().GroupVersion ().String ()).To (Equal ("v1" ))
186
+ Expect (list .GetKind ()).To (Equal ("EndpointsList" ))
181
187
Expect (list .Items ).To (HaveLen (1 ))
182
188
}
183
189
@@ -247,6 +253,8 @@ var _ = Describe("Fake client", func() {
247
253
list .SetAPIVersion ("custom/v3" )
248
254
list .SetKind ("ImageList" )
249
255
err := cl .List (context .Background (), list )
256
+ Expect (list .GroupVersionKind ().GroupVersion ().String ()).To (Equal ("custom/v3" ))
257
+ Expect (list .GetKind ()).To (Equal ("ImageList" ))
250
258
Expect (err ).ToNot (HaveOccurred ())
251
259
})
252
260
@@ -255,6 +263,8 @@ var _ = Describe("Fake client", func() {
255
263
list .SetAPIVersion ("custom/v4" )
256
264
list .SetKind ("Image" )
257
265
err := cl .List (context .Background (), list )
266
+ Expect (list .GroupVersionKind ().GroupVersion ().String ()).To (Equal ("custom/v4" ))
267
+ Expect (list .GetKind ()).To (Equal ("Image" ))
258
268
Expect (err ).ToNot (HaveOccurred ())
259
269
})
260
270
@@ -1325,6 +1335,20 @@ var _ = Describe("Fake client", func() {
1325
1335
Expect (list .Items ).To (BeEmpty ())
1326
1336
})
1327
1337
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
+
1328
1352
It ("errors when there's no Index matching the field name" , func () {
1329
1353
listOpts := & client.ListOptions {
1330
1354
FieldSelector : fields .OneTermEqualSelector ("spec.paused" , "false" ),
0 commit comments