Skip to content

Commit cd5151e

Browse files
committed
Ignores type comp in EPP reconciler tests
Signed-off-by: Daneyon Hansen <[email protected]>
1 parent cbca4c5 commit cd5151e

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

pkg/epp/controller/inferencepool_reconciler_test.go

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ import (
2323

2424
"github.com/google/go-cmp/cmp"
2525
"github.com/google/go-cmp/cmp/cmpopts"
26+
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
2627
corev1 "k8s.io/api/core/v1"
2728
"k8s.io/apimachinery/pkg/runtime"
2829
"k8s.io/apimachinery/pkg/runtime/schema"
@@ -180,7 +181,9 @@ type diffStoreParams struct {
180181

181182
func diffStore(datastore datastore.Datastore, params diffStoreParams) string {
182183
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 != "" {
184187
return "pool:" + diff
185188
}
186189

@@ -333,7 +336,10 @@ func xDiffStore(t *testing.T, datastore datastore.Datastore, params xDiffStorePa
333336
if err != nil {
334337
t.Fatalf("failed to convert InferencePool to XInferencePool: %v", err)
335338
}
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 != "" {
337343
return "pool:" + diff
338344
}
339345

0 commit comments

Comments
 (0)