diff --git a/internal/controllers/operator_controller_test.go b/internal/controllers/operator_controller_test.go index 1f75c0518..0fe73f44e 100644 --- a/internal/controllers/operator_controller_test.go +++ b/internal/controllers/operator_controller_test.go @@ -78,7 +78,7 @@ var _ = Describe("Operator Controller Test", func() { By("running reconcile") res, err := reconciler.Reconcile(ctx, ctrl.Request{NamespacedName: opKey}) Expect(res).To(Equal(ctrl.Result{})) - Expect(err).To(MatchError(fmt.Sprintf("package '%s' not found", pkgName))) + Expect(err).To(MatchError(fmt.Sprintf("no package '%s' found", pkgName))) By("fetching updated operator after reconcile") Expect(cl.Get(ctx, opKey, operator)).NotTo(HaveOccurred()) @@ -92,7 +92,7 @@ var _ = Describe("Operator Controller Test", func() { Expect(cond).NotTo(BeNil()) Expect(cond.Status).To(Equal(metav1.ConditionFalse)) Expect(cond.Reason).To(Equal(operatorsv1alpha1.ReasonResolutionFailed)) - Expect(cond.Message).To(Equal(fmt.Sprintf("package '%s' not found", pkgName))) + Expect(cond.Message).To(Equal(fmt.Sprintf("no package '%s' found", pkgName))) }) }) When("the operator specifies a version that does not exist", func() { @@ -114,7 +114,7 @@ var _ = Describe("Operator Controller Test", func() { By("running reconcile") res, err := reconciler.Reconcile(ctx, ctrl.Request{NamespacedName: opKey}) Expect(res).To(Equal(ctrl.Result{})) - Expect(err).To(MatchError(fmt.Sprintf("package '%s' at version '0.50.0' not found", pkgName))) + Expect(err).To(MatchError(fmt.Sprintf("no package '%s' matching version '0.50.0' found", pkgName))) By("fetching updated operator after reconcile") Expect(cl.Get(ctx, opKey, operator)).NotTo(HaveOccurred()) @@ -128,7 +128,7 @@ var _ = Describe("Operator Controller Test", func() { Expect(cond).NotTo(BeNil()) Expect(cond.Status).To(Equal(metav1.ConditionFalse)) Expect(cond.Reason).To(Equal(operatorsv1alpha1.ReasonResolutionFailed)) - Expect(cond.Message).To(Equal(fmt.Sprintf("package '%s' at version '0.50.0' not found", pkgName))) + Expect(cond.Message).To(Equal(fmt.Sprintf("no package '%s' matching version '0.50.0' found", pkgName))) cond = apimeta.FindStatusCondition(operator.Status.Conditions, operatorsv1alpha1.TypeInstalled) Expect(cond).NotTo(BeNil()) Expect(cond.Status).To(Equal(metav1.ConditionUnknown)) @@ -760,7 +760,7 @@ var _ = Describe("Operator Controller Test", func() { By("running reconcile") res, err := reconciler.Reconcile(ctx, ctrl.Request{NamespacedName: opKey}) Expect(res).To(Equal(ctrl.Result{})) - Expect(err).To(MatchError(fmt.Sprintf("package '%s' at version '%s' in channel '%s' not found", pkgName, pkgVer, pkgChan))) + Expect(err).To(MatchError(fmt.Sprintf("no package '%s' matching version '%s' found in channel '%s'", pkgName, pkgVer, pkgChan))) By("fetching updated operator after reconcile") Expect(cl.Get(ctx, opKey, operator)).NotTo(HaveOccurred()) @@ -774,7 +774,7 @@ var _ = Describe("Operator Controller Test", func() { Expect(cond).NotTo(BeNil()) Expect(cond.Status).To(Equal(metav1.ConditionFalse)) Expect(cond.Reason).To(Equal(operatorsv1alpha1.ReasonResolutionFailed)) - Expect(cond.Message).To(Equal(fmt.Sprintf("package '%s' at version '%s' in channel '%s' not found", pkgName, pkgVer, pkgChan))) + Expect(cond.Message).To(Equal(fmt.Sprintf("no package '%s' matching version '%s' found in channel '%s'", pkgName, pkgVer, pkgChan))) cond = apimeta.FindStatusCondition(operator.Status.Conditions, operatorsv1alpha1.TypeInstalled) Expect(cond).NotTo(BeNil()) Expect(cond.Status).To(Equal(metav1.ConditionUnknown)) @@ -803,7 +803,7 @@ var _ = Describe("Operator Controller Test", func() { By("running reconcile") res, err := reconciler.Reconcile(ctx, ctrl.Request{NamespacedName: opKey}) Expect(res).To(Equal(ctrl.Result{})) - Expect(err).To(MatchError(fmt.Sprintf("package '%s' in channel '%s' not found", pkgName, pkgChan))) + Expect(err).To(MatchError(fmt.Sprintf("no package '%s' found in channel '%s'", pkgName, pkgChan))) By("fetching updated operator after reconcile") Expect(cl.Get(ctx, opKey, operator)).NotTo(HaveOccurred()) @@ -817,7 +817,7 @@ var _ = Describe("Operator Controller Test", func() { Expect(cond).NotTo(BeNil()) Expect(cond.Status).To(Equal(metav1.ConditionFalse)) Expect(cond.Reason).To(Equal(operatorsv1alpha1.ReasonResolutionFailed)) - Expect(cond.Message).To(Equal(fmt.Sprintf("package '%s' in channel '%s' not found", pkgName, pkgChan))) + Expect(cond.Message).To(Equal(fmt.Sprintf("no package '%s' found in channel '%s'", pkgName, pkgChan))) cond = apimeta.FindStatusCondition(operator.Status.Conditions, operatorsv1alpha1.TypeInstalled) Expect(cond).NotTo(BeNil()) Expect(cond.Status).To(Equal(metav1.ConditionUnknown)) @@ -849,7 +849,7 @@ var _ = Describe("Operator Controller Test", func() { By("running reconcile") res, err := reconciler.Reconcile(ctx, ctrl.Request{NamespacedName: opKey}) Expect(res).To(Equal(ctrl.Result{})) - Expect(err).To(MatchError(fmt.Sprintf("package '%s' at version '%s' in channel '%s' not found", pkgName, pkgVer, pkgChan))) + Expect(err).To(MatchError(fmt.Sprintf("no package '%s' matching version '%s' found in channel '%s'", pkgName, pkgVer, pkgChan))) By("fetching updated operator after reconcile") Expect(cl.Get(ctx, opKey, operator)).NotTo(HaveOccurred()) @@ -863,7 +863,7 @@ var _ = Describe("Operator Controller Test", func() { Expect(cond).NotTo(BeNil()) Expect(cond.Status).To(Equal(metav1.ConditionFalse)) Expect(cond.Reason).To(Equal(operatorsv1alpha1.ReasonResolutionFailed)) - Expect(cond.Message).To(Equal(fmt.Sprintf("package '%s' at version '%s' in channel '%s' not found", pkgName, pkgVer, pkgChan))) + Expect(cond.Message).To(Equal(fmt.Sprintf("no package '%s' matching version '%s' found in channel '%s'", pkgName, pkgVer, pkgChan))) cond = apimeta.FindStatusCondition(operator.Status.Conditions, operatorsv1alpha1.TypeInstalled) Expect(cond).NotTo(BeNil()) Expect(cond.Status).To(Equal(metav1.ConditionUnknown)) diff --git a/internal/resolution/variablesources/required_package.go b/internal/resolution/variablesources/required_package.go index 568a7ebfa..e45df4e17 100644 --- a/internal/resolution/variablesources/required_package.go +++ b/internal/resolution/variablesources/required_package.go @@ -91,18 +91,14 @@ func (r *RequiredPackageVariableSource) GetVariables(ctx context.Context) ([]dep } func (r *RequiredPackageVariableSource) notFoundError() error { - // TODO: update this error message when/if we decide to support version ranges as opposed to fixing the version - // context: we originally wanted to support version ranges and take the highest version that satisfies the range - // during the upstream call on the 2023-04-11 we decided to pin the version instead. But, we'll keep version range - // support under the covers in case we decide to pivot back. if r.versionRange != "" && r.channelName != "" { - return fmt.Errorf("package '%s' at version '%s' in channel '%s' not found", r.packageName, r.versionRange, r.channelName) + return fmt.Errorf("no package '%s' matching version '%s' found in channel '%s'", r.packageName, r.versionRange, r.channelName) } if r.versionRange != "" { - return fmt.Errorf("package '%s' at version '%s' not found", r.packageName, r.versionRange) + return fmt.Errorf("no package '%s' matching version '%s' found", r.packageName, r.versionRange) } if r.channelName != "" { - return fmt.Errorf("package '%s' in channel '%s' not found", r.packageName, r.channelName) + return fmt.Errorf("no package '%s' found in channel '%s'", r.packageName, r.channelName) } - return fmt.Errorf("package '%s' not found", r.packageName) + return fmt.Errorf("no package '%s' found", r.packageName) } diff --git a/internal/resolution/variablesources/required_package_test.go b/internal/resolution/variablesources/required_package_test.go index ae87f874e..a6f0bd32a 100644 --- a/internal/resolution/variablesources/required_package_test.go +++ b/internal/resolution/variablesources/required_package_test.go @@ -122,7 +122,7 @@ var _ = Describe("RequiredPackageVariableSource", func() { Expect(err).NotTo(HaveOccurred()) _, err = rpvs.GetVariables(context.TODO()) Expect(err).To(HaveOccurred()) - Expect(err).To(MatchError("package 'test-package' not found")) + Expect(err).To(MatchError("no package 'test-package' found")) }) It("should return an error if catalog client errors", func() { diff --git a/test/e2e/install_test.go b/test/e2e/install_test.go index 368970cdf..3a2f262f6 100644 --- a/test/e2e/install_test.go +++ b/test/e2e/install_test.go @@ -155,7 +155,7 @@ var _ = Describe("Operator Install", func() { g.Expect(cond).ToNot(BeNil()) g.Expect(cond.Status).To(Equal(metav1.ConditionFalse)) g.Expect(cond.Reason).To(Equal(operatorv1alpha1.ReasonResolutionFailed)) - g.Expect(cond.Message).To(Equal(fmt.Sprintf("package '%s' not found", pkgName))) + g.Expect(cond.Message).To(Equal(fmt.Sprintf("no package '%s' found", pkgName))) }).Should(Succeed()) By("creating an Operator catalog with the desired package")