mirror of
https://github.com/k3s-io/kubernetes.git
synced 2026-07-17 20:00:07 +00:00
Address feedbacks
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
|
||||
@@ -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...)
|
||||
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user