mirror of
https://github.com/k3s-io/kubernetes.git
synced 2026-02-22 07:03:28 +00:00
Address feedback: simpliy errormatcher instantiation
This commit is contained in:
@@ -235,12 +235,7 @@ func verifyValidationEquivalence(t *testing.T, expectedErrs field.ErrorList, run
|
||||
var imperativeErrs field.ErrorList
|
||||
|
||||
// The errOutputMatcher is used to verify the output matches the expected errors in test cases.
|
||||
errOutputMatcher := field.ErrorMatcher{}.ByType().ByOrigin()
|
||||
if len(opt.NormalizationRules) > 0 {
|
||||
errOutputMatcher = errOutputMatcher.ByFieldNormalized(opt.NormalizationRules)
|
||||
} else {
|
||||
errOutputMatcher = errOutputMatcher.ByField()
|
||||
}
|
||||
errOutputMatcher := field.ErrorMatcher{}.ByType().ByOrigin().ByFieldNormalized(opt.NormalizationRules)
|
||||
|
||||
// We only need to test both gate enabled and disabled together, because
|
||||
// 1) the DeclarativeValidationTakeover won't take effect if DeclarativeValidation is disabled.
|
||||
|
||||
@@ -179,12 +179,7 @@ func gatherDeclarativeValidationMismatches(imperativeErrs, declarativeErrs field
|
||||
if takeover {
|
||||
recommendation = "Consider disabling the DeclarativeValidationTakeover feature gate to keep data persisted in etcd consistent with prior versions of Kubernetes."
|
||||
}
|
||||
fuzzyMatcher := field.ErrorMatcher{}.ByType().ByOrigin().RequireOriginWhenInvalid()
|
||||
if len(normalizationRules) > 0 {
|
||||
fuzzyMatcher = fuzzyMatcher.ByFieldNormalized(normalizationRules)
|
||||
} else {
|
||||
fuzzyMatcher = fuzzyMatcher.ByField()
|
||||
}
|
||||
fuzzyMatcher := field.ErrorMatcher{}.ByType().ByOrigin().RequireOriginWhenInvalid().ByFieldNormalized(normalizationRules)
|
||||
exactMatcher := field.ErrorMatcher{}.Exactly()
|
||||
|
||||
// Dedupe imperative errors of exact error matches as they are
|
||||
|
||||
Reference in New Issue
Block a user