From 769040191fc415cb4dde68df0dfffc294cb4eaf2 Mon Sep 17 00:00:00 2001 From: "W. Trevor King" Date: Thu, 19 Jan 2023 15:35:18 -0800 Subject: [PATCH] lib/validation: Drop "a previous version" from desiredUpdate validation Narrowly catching up with c80bd024a8 (pkg/cvo/updatepayload: Drop history from target pullspec lookup, 2021-11-03, #684), which removed that option from the implementation. Having the validation code living so far from the implementation code makes us more vulnerable to this kind of divergence, but I'll leave larger refactorings to follow-up work. --- lib/validation/validation.go | 2 +- pkg/cvo/cvo_test.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/validation/validation.go b/lib/validation/validation.go index 686ed16c93..ef5a1b8483 100644 --- a/lib/validation/validation.go +++ b/lib/validation/validation.go @@ -41,7 +41,7 @@ func ValidateClusterVersion(config *configv1.ClusterVersion) field.ErrorList { switch countPayloadsForVersion(config, u.Version) { case 0: errs = append(errs, field.Invalid(field.NewPath("spec", "desiredUpdate", "version"), u.Version, - "when image is empty the update must be a previous version or an available update")) + "when image is empty the update must be an available update")) case 1: default: errs = append(errs, field.Invalid(field.NewPath("spec", "desiredUpdate", "version"), u.Version, diff --git a/pkg/cvo/cvo_test.go b/pkg/cvo/cvo_test.go index 3c6045de57..07e5a5e8a2 100644 --- a/pkg/cvo/cvo_test.go +++ b/pkg/cvo/cvo_test.go @@ -1865,7 +1865,7 @@ func TestOperator_sync(t *testing.T) { }, ObservedGeneration: 2, Conditions: []configv1.ClusterOperatorStatusCondition{ - {Type: ClusterVersionInvalid, Status: configv1.ConditionTrue, Reason: "InvalidClusterVersion", Message: "The cluster version is invalid: spec.desiredUpdate.version: Invalid value: \"4.0.4\": when image is empty the update must be a previous version or an available update"}, + {Type: ClusterVersionInvalid, Status: configv1.ConditionTrue, Reason: "InvalidClusterVersion", Message: "The cluster version is invalid: spec.desiredUpdate.version: Invalid value: \"4.0.4\": when image is empty the update must be an available update"}, {Type: ImplicitlyEnabledCapabilities, Status: "False", Reason: "AsExpected", Message: "Capabilities match configured spec"}, {Type: configv1.OperatorAvailable, Status: configv1.ConditionTrue, Message: "Done applying 4.0.1"}, {Type: ClusterStatusFailing, Status: configv1.ConditionFalse},