Skip to content

Commit f318e7e

Browse files
author
Mikalai Radchuk
committed
Update not found error message wording
Signed-off-by: Mikalai Radchuk <[email protected]>
1 parent e001a0f commit f318e7e

File tree

2 files changed

+8
-12
lines changed

2 files changed

+8
-12
lines changed

internal/controllers/operator_controller_test.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ var _ = Describe("Operator Controller Test", func() {
114114
By("running reconcile")
115115
res, err := reconciler.Reconcile(ctx, ctrl.Request{NamespacedName: opKey})
116116
Expect(res).To(Equal(ctrl.Result{}))
117-
Expect(err).To(MatchError(fmt.Sprintf("package '%s' at version '0.50.0' not found", pkgName)))
117+
Expect(err).To(MatchError(fmt.Sprintf("package '%s' matching version '0.50.0' not found", pkgName)))
118118

119119
By("fetching updated operator after reconcile")
120120
Expect(cl.Get(ctx, opKey, operator)).NotTo(HaveOccurred())
@@ -128,7 +128,7 @@ var _ = Describe("Operator Controller Test", func() {
128128
Expect(cond).NotTo(BeNil())
129129
Expect(cond.Status).To(Equal(metav1.ConditionFalse))
130130
Expect(cond.Reason).To(Equal(operatorsv1alpha1.ReasonResolutionFailed))
131-
Expect(cond.Message).To(Equal(fmt.Sprintf("package '%s' at version '0.50.0' not found", pkgName)))
131+
Expect(cond.Message).To(Equal(fmt.Sprintf("package '%s' matching version '0.50.0' not found", pkgName)))
132132
cond = apimeta.FindStatusCondition(operator.Status.Conditions, operatorsv1alpha1.TypeInstalled)
133133
Expect(cond).NotTo(BeNil())
134134
Expect(cond.Status).To(Equal(metav1.ConditionUnknown))
@@ -760,7 +760,7 @@ var _ = Describe("Operator Controller Test", func() {
760760
By("running reconcile")
761761
res, err := reconciler.Reconcile(ctx, ctrl.Request{NamespacedName: opKey})
762762
Expect(res).To(Equal(ctrl.Result{}))
763-
Expect(err).To(MatchError(fmt.Sprintf("package '%s' at version '%s' in channel '%s' not found", pkgName, pkgVer, pkgChan)))
763+
Expect(err).To(MatchError(fmt.Sprintf("package '%s' matching version '%s' in channel '%s' not found", pkgName, pkgVer, pkgChan)))
764764

765765
By("fetching updated operator after reconcile")
766766
Expect(cl.Get(ctx, opKey, operator)).NotTo(HaveOccurred())
@@ -774,7 +774,7 @@ var _ = Describe("Operator Controller Test", func() {
774774
Expect(cond).NotTo(BeNil())
775775
Expect(cond.Status).To(Equal(metav1.ConditionFalse))
776776
Expect(cond.Reason).To(Equal(operatorsv1alpha1.ReasonResolutionFailed))
777-
Expect(cond.Message).To(Equal(fmt.Sprintf("package '%s' at version '%s' in channel '%s' not found", pkgName, pkgVer, pkgChan)))
777+
Expect(cond.Message).To(Equal(fmt.Sprintf("package '%s' matching version '%s' in channel '%s' not found", pkgName, pkgVer, pkgChan)))
778778
cond = apimeta.FindStatusCondition(operator.Status.Conditions, operatorsv1alpha1.TypeInstalled)
779779
Expect(cond).NotTo(BeNil())
780780
Expect(cond.Status).To(Equal(metav1.ConditionUnknown))
@@ -849,7 +849,7 @@ var _ = Describe("Operator Controller Test", func() {
849849
By("running reconcile")
850850
res, err := reconciler.Reconcile(ctx, ctrl.Request{NamespacedName: opKey})
851851
Expect(res).To(Equal(ctrl.Result{}))
852-
Expect(err).To(MatchError(fmt.Sprintf("package '%s' at version '%s' in channel '%s' not found", pkgName, pkgVer, pkgChan)))
852+
Expect(err).To(MatchError(fmt.Sprintf("package '%s' matching version '%s' in channel '%s' not found", pkgName, pkgVer, pkgChan)))
853853

854854
By("fetching updated operator after reconcile")
855855
Expect(cl.Get(ctx, opKey, operator)).NotTo(HaveOccurred())
@@ -863,7 +863,7 @@ var _ = Describe("Operator Controller Test", func() {
863863
Expect(cond).NotTo(BeNil())
864864
Expect(cond.Status).To(Equal(metav1.ConditionFalse))
865865
Expect(cond.Reason).To(Equal(operatorsv1alpha1.ReasonResolutionFailed))
866-
Expect(cond.Message).To(Equal(fmt.Sprintf("package '%s' at version '%s' in channel '%s' not found", pkgName, pkgVer, pkgChan)))
866+
Expect(cond.Message).To(Equal(fmt.Sprintf("package '%s' matching version '%s' in channel '%s' not found", pkgName, pkgVer, pkgChan)))
867867
cond = apimeta.FindStatusCondition(operator.Status.Conditions, operatorsv1alpha1.TypeInstalled)
868868
Expect(cond).NotTo(BeNil())
869869
Expect(cond.Status).To(Equal(metav1.ConditionUnknown))

internal/resolution/variablesources/required_package.go

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -91,15 +91,11 @@ func (r *RequiredPackageVariableSource) GetVariables(ctx context.Context) ([]dep
9191
}
9292

9393
func (r *RequiredPackageVariableSource) notFoundError() error {
94-
// TODO: update this error message when/if we decide to support version ranges as opposed to fixing the version
95-
// context: we originally wanted to support version ranges and take the highest version that satisfies the range
96-
// during the upstream call on the 2023-04-11 we decided to pin the version instead. But, we'll keep version range
97-
// support under the covers in case we decide to pivot back.
9894
if r.versionRange != "" && r.channelName != "" {
99-
return fmt.Errorf("package '%s' at version '%s' in channel '%s' not found", r.packageName, r.versionRange, r.channelName)
95+
return fmt.Errorf("package '%s' matching version '%s' in channel '%s' not found", r.packageName, r.versionRange, r.channelName)
10096
}
10197
if r.versionRange != "" {
102-
return fmt.Errorf("package '%s' at version '%s' not found", r.packageName, r.versionRange)
98+
return fmt.Errorf("package '%s' matching version '%s' not found", r.packageName, r.versionRange)
10399
}
104100
if r.channelName != "" {
105101
return fmt.Errorf("package '%s' in channel '%s' not found", r.packageName, r.channelName)

0 commit comments

Comments
 (0)