Skip to content

Commit 749f7a0

Browse files
committed
revert cmp.Diff in fuzz
1 parent 2523e12 commit 749f7a0

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

pkg/conversion/test/fuzz/fuzz.go

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ import (
2222
"regexp"
2323
"time"
2424

25-
"github.com/google/go-cmp/cmp"
2625
. "github.com/onsi/ginkgo/v2"
2726
. "github.com/onsi/gomega"
2827

@@ -140,7 +139,7 @@ func CAPI2MAPIMachineRoundTripFuzzTest(scheme *runtime.Scheme, infra *configv1.I
140139

141140
capiMachine.Finalizers = nil
142141
Expect(capiMachine.TypeMeta).To(Equal(in.machine.TypeMeta))
143-
Expect(capiMachine.ObjectMeta).To(Equal(in.machine.ObjectMeta), fmt.Sprintf("diff: %s\nENDDIFF", cmp.Diff(capiMachine.TypeMeta, in.machine.TypeMeta)))
142+
Expect(capiMachine.ObjectMeta).To(Equal(in.machine.ObjectMeta))
144143
Expect(capiMachine.Spec).To(Equal(in.machine.Spec))
145144

146145
infraMachine.SetFinalizers(nil)
@@ -222,7 +221,7 @@ func CAPI2MAPIMachineSetRoundTripFuzzTest(scheme *runtime.Scheme, infra *configv
222221
capiMachineSet.Spec.Template.Spec.InfrastructureRef.Name = in.machineSet.Spec.Template.Spec.InfrastructureRef.Name
223222

224223
Expect(capiMachineSet.TypeMeta).To(Equal(in.machineSet.TypeMeta))
225-
Expect(capiMachineSet.ObjectMeta).To(Equal(in.machineSet.ObjectMeta), fmt.Sprintf("diff: %s", cmp.Diff(capiMachineSet.ObjectMeta, in.machineSet.ObjectMeta)))
224+
Expect(capiMachineSet.ObjectMeta).To(Equal(in.machineSet.ObjectMeta))
226225
Expect(capiMachineSet.Spec).To(Equal(in.machineSet.Spec))
227226

228227
// The conditions are not a 1:1 mapping conversion between CAPI and MAPI.
@@ -306,8 +305,8 @@ func MAPI2CAPIMachineRoundTripFuzzTest(scheme *runtime.Scheme, infra *configv1.I
306305

307306
mapiMachine.Finalizers = nil
308307
Expect(mapiMachine.TypeMeta).To(Equal(in.machine.TypeMeta), "converted MAPI machine should have matching .typeMeta")
309-
Expect(mapiMachine.ObjectMeta).To(Equal(in.machine.ObjectMeta), fmt.Sprintf("converted MAPI machine should have matching .metadata: %s", cmp.Diff(mapiMachine.ObjectMeta, in.machine.ObjectMeta)))
310-
Expect(mapiMachine.Spec).To(WithTransform(ignoreMachineProviderSpec, testutils.MatchViaJSON(ignoreMachineProviderSpec(in.machine.Spec))), fmt.Sprintf("converted MAPI machine should have matching .spec: %s", cmp.Diff(mapiMachine.ObjectMeta, in.machine.ObjectMeta)))
308+
Expect(mapiMachine.ObjectMeta).To(Equal(in.machine.ObjectMeta), fmt.Sprintf("converted MAPI machine should have matching .metadata"))
309+
Expect(mapiMachine.Spec).To(WithTransform(ignoreMachineProviderSpec, testutils.MatchViaJSON(ignoreMachineProviderSpec(in.machine.Spec))), fmt.Sprintf("converted MAPI machine should have matching .spec"))
311310
Expect(mapiMachine.Spec.ProviderSpec.Value.Raw).To(MatchJSON(in.machine.Spec.ProviderSpec.Value.Raw), "converted MAPI machine should have matching .spec.providerSpec")
312311
}, machineFuzzInputs)
313312
}
@@ -362,7 +361,7 @@ func MAPI2CAPIMachineSetRoundTripFuzzTest(scheme *runtime.Scheme, infra *configv
362361
Expect(mapiMachineSet.TypeMeta).To(Equal(in.machineSet.TypeMeta), "converted MAPI machine set should have matching .typeMeta")
363362
Expect(mapiMachineSet.ObjectMeta).To(Equal(in.machineSet.ObjectMeta), "converted MAPI machine set should have matching .metadata")
364363
Expect(mapiMachineSet.Status).To(Equal(in.machineSet.Status), "converted MAPI machine set should have matching .status")
365-
Expect(mapiMachineSet.Spec).To(WithTransform(ignoreMachineSetProviderSpec, testutils.MatchViaJSON(ignoreMachineSetProviderSpec(in.machineSet.Spec))), fmt.Sprintf("converted MAPI machine set should have matching .spec: %s", cmp.Diff(ignoreMachineSetProviderSpec(mapiMachineSet.Spec), ignoreMachineSetProviderSpec(in.machineSet.Spec))))
364+
Expect(mapiMachineSet.Spec).To(WithTransform(ignoreMachineSetProviderSpec, testutils.MatchViaJSON(ignoreMachineSetProviderSpec(in.machineSet.Spec))), fmt.Sprintf("converted MAPI machine set should have matching .spec"))
366365
Expect(mapiMachineSet.Spec.Template.Spec.ProviderSpec.Value.Raw).To(MatchJSON(in.machineSet.Spec.Template.Spec.ProviderSpec.Value.Raw), "converted MAPI machine set should have matching .spec.template.spec.providerSpec")
367366
}, machineFuzzInputs)
368367
}

0 commit comments

Comments
 (0)