@@ -23,6 +23,7 @@ import (
23
23
24
24
"github.com/google/go-cmp/cmp"
25
25
"github.com/google/go-cmp/cmp/cmpopts"
26
+ metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
26
27
corev1 "k8s.io/api/core/v1"
27
28
"k8s.io/apimachinery/pkg/runtime"
28
29
"k8s.io/apimachinery/pkg/runtime/schema"
@@ -180,7 +181,9 @@ type diffStoreParams struct {
180
181
181
182
func diffStore (datastore datastore.Datastore , params diffStoreParams ) string {
182
183
gotPool , _ := datastore .PoolGet ()
183
- if diff := cmp .Diff (params .wantPool , gotPool ); diff != "" {
184
+ // controller-runtime fake client may not populate TypeMeta (APIVersion/Kind).
185
+ // Ignore it when comparing pools.
186
+ if diff := cmp .Diff (params .wantPool , gotPool , cmpopts .IgnoreTypes (metav1.TypeMeta {})); diff != "" {
184
187
return "pool:" + diff
185
188
}
186
189
@@ -333,7 +336,10 @@ func xDiffStore(t *testing.T, datastore datastore.Datastore, params xDiffStorePa
333
336
if err != nil {
334
337
t .Fatalf ("failed to convert InferencePool to XInferencePool: %v" , err )
335
338
}
336
- if diff := cmp .Diff (params .wantPool , gotXPool ); diff != "" {
339
+
340
+ // controller-runtime fake client may not populate TypeMeta (APIVersion/Kind).
341
+ // Ignore it when comparing pools.
342
+ if diff := cmp .Diff (params .wantPool , gotXPool , cmpopts .IgnoreTypes (metav1.TypeMeta {})); diff != "" {
337
343
return "pool:" + diff
338
344
}
339
345
0 commit comments