Address feedbacks

This commit is contained in:
Lalit Chauhan
2026-01-06 18:38:35 +00:00
parent e83723ce2c
commit 4e6aafb9b3
3 changed files with 7 additions and 4 deletions

View File

@@ -202,7 +202,8 @@ type validationOption struct {
// NormalizationRules are the rules to apply to field paths before comparison.
NormalizationRules []field.NormalizationRule
// IgnoreObjectConversions skips the tests if the conversion between object fails.
// IgnoreObjectConversions skips the tests if the conversion from the internal object
// to the versioned object fails.
IgnoreObjectConversionErrors bool
}

View File

@@ -74,7 +74,9 @@ func TestVersionedValidationByFuzzing(t *testing.T) {
allRules := append([]field.NormalizationRule{}, resourcevalidation.ResourceNormalizationRules...)
allRules = append(allRules, nodevalidation.NodeNormalizationRules...)
opts = append(opts, WithNormalizationRules(allRules...))
opts = append(opts, WithIgnoreObjectConversionErrors())
if gv.Group == "autoscaling" {
opts = append(opts, WithIgnoreObjectConversionErrors())
}
VerifyVersionedValidationEquivalence(t, obj, nil, opts...)

View File

@@ -98,7 +98,7 @@ func runUpdateValidation(t *testing.T, scheme *runtime.Scheme, options []string,
t.Fatal(err)
}
err = scheme.Convert(unversionedNew, versionedNew, nil)
if err != nil && ignoreConversionErrors {
if ignoreConversionErrors && err != nil {
t.Skipf("Failed to convert object from internal type to %s: %v", gvk.Version, err)
} else if err != nil {
t.Fatal(err)
@@ -111,7 +111,7 @@ func runUpdateValidation(t *testing.T, scheme *runtime.Scheme, options []string,
}
err = scheme.Convert(unversionedOld, versionedOld, nil)
if err != nil && ignoreConversionErrors {
if ignoreConversionErrors && err != nil {
t.Skipf("Failed to convert object from internal type to %s: %v", gvk.Version, err)
} else if err != nil {
t.Fatal(err)