@@ -67,7 +67,7 @@ var _ = Describe("Operator Install", func() {
67
67
g .Expect (cond .Status ).To (Equal (metav1 .ConditionTrue ))
68
68
g .Expect (cond .Reason ).To (Equal (operatorv1alpha1 .ReasonSuccess ))
69
69
g .Expect (cond .Message ).To (ContainSubstring ("resolved to" ))
70
- g .Expect (operator .Status .ResolvedBundleResource ).To (Equal ("localhost/testdata/bundles/registry-v1/prometheus-operator:v0.65.1 " ))
70
+ g .Expect (operator .Status .ResolvedBundleResource ).To (Equal ("localhost/testdata/bundles/registry-v1/prometheus-operator:v2.0.0 " ))
71
71
}).Should (Succeed ())
72
72
73
73
By ("eventually installing the package successfully" )
@@ -180,48 +180,56 @@ var _ = Describe("Operator Install", func() {
180
180
}).Should (Succeed ())
181
181
})
182
182
183
- It ("handles upgrade edges correctly" , func () {
184
- By ("creating a valid Operator resource" )
185
- operator .Spec = operatorv1alpha1.OperatorSpec {
186
- PackageName : "prometheus" ,
187
- Version : "0.37.0" ,
188
- }
189
- Expect (c .Create (ctx , operator )).To (Succeed ())
190
- By ("eventually reporting a successful resolution" )
191
- Eventually (func (g Gomega ) {
192
- g .Expect (c .Get (ctx , types.NamespacedName {Name : operator .Name }, operator )).To (Succeed ())
193
- cond := apimeta .FindStatusCondition (operator .Status .Conditions , operatorv1alpha1 .TypeResolved )
194
- g .Expect (cond ).ToNot (BeNil ())
195
- g .Expect (cond .Reason ).To (Equal (operatorv1alpha1 .ReasonSuccess ))
196
- g .Expect (cond .Message ).To (ContainSubstring ("resolved to" ))
197
- g .Expect (operator .Status .ResolvedBundleResource ).ToNot (BeEmpty ())
198
- }).Should (Succeed ())
183
+ When ("resolving upgrade edges" , func () {
184
+ BeforeEach (func () {
185
+ By ("creating an Operator at a specified version" )
186
+ operator .Spec = operatorv1alpha1.OperatorSpec {
187
+ PackageName : "prometheus" ,
188
+ Version : "1.0.0" ,
189
+ }
190
+ Expect (c .Create (ctx , operator )).To (Succeed ())
191
+ By ("eventually reporting a successful resolution" )
192
+ Eventually (func (g Gomega ) {
193
+ g .Expect (c .Get (ctx , types.NamespacedName {Name : operator .Name }, operator )).To (Succeed ())
194
+ cond := apimeta .FindStatusCondition (operator .Status .Conditions , operatorv1alpha1 .TypeResolved )
195
+ g .Expect (cond ).ToNot (BeNil ())
196
+ g .Expect (cond .Reason ).To (Equal (operatorv1alpha1 .ReasonSuccess ))
197
+ g .Expect (cond .Message ).To (ContainSubstring ("resolved to" ))
198
+ g .Expect (operator .Status .ResolvedBundleResource ).To (Equal ("localhost/testdata/bundles/registry-v1/prometheus-operator:v1.0.0" ))
199
+ }).Should (Succeed ())
200
+ })
199
201
200
- By ("updating the Operator resource to a non-successor version" )
201
- operator .Spec .Version = "0.65.1" // current (0.37.0) and successor (0.47.0) are the only values that would be SAT.
202
- Expect (c .Update (ctx , operator )).To (Succeed ())
203
- By ("eventually reporting an unsatisfiable resolution" )
204
- Eventually (func (g Gomega ) {
205
- g .Expect (c .Get (ctx , types.NamespacedName {Name : operator .Name }, operator )).To (Succeed ())
206
- cond := apimeta .FindStatusCondition (operator .Status .Conditions , operatorv1alpha1 .TypeResolved )
207
- g .Expect (cond ).ToNot (BeNil ())
208
- g .Expect (cond .Reason ).To (Equal (operatorv1alpha1 .ReasonResolutionFailed ))
209
- g .Expect (cond .Message ).To (MatchRegexp (`^constraints not satisfiable:.*; installed package prometheus requires at least one of.*0.47.0[^,]*,[^,]*0.37.0[^;]*;.*` ))
210
- g .Expect (operator .Status .ResolvedBundleResource ).To (BeEmpty ())
211
- }).Should (Succeed ())
202
+ It ("does not allow to upgrade the Operator to a non-successor version" , func () {
203
+ By ("updating the Operator resource to a non-successor version" )
204
+ // Semver only allows upgrades within major version at the moment.
205
+ operator .Spec .Version = "2.0.0"
206
+ Expect (c .Update (ctx , operator )).To (Succeed ())
207
+ By ("eventually reporting an unsatisfiable resolution" )
208
+ Eventually (func (g Gomega ) {
209
+ g .Expect (c .Get (ctx , types.NamespacedName {Name : operator .Name }, operator )).To (Succeed ())
210
+ cond := apimeta .FindStatusCondition (operator .Status .Conditions , operatorv1alpha1 .TypeResolved )
211
+ g .Expect (cond ).ToNot (BeNil ())
212
+ g .Expect (cond .Reason ).To (Equal (operatorv1alpha1 .ReasonResolutionFailed ))
213
+ g .Expect (cond .Message ).To (MatchRegexp (`^constraints not satisfiable:.*; installed package prometheus requires at least one of.*1.2.0[^;]*;.*` ))
214
+ g .Expect (operator .Status .ResolvedBundleResource ).To (BeEmpty ())
215
+ }).Should (Succeed ())
216
+ })
212
217
213
- By ("updating the Operator resource to a valid upgrade edge" )
214
- operator .Spec .Version = "0.47.0"
215
- Expect (c .Update (ctx , operator )).To (Succeed ())
216
- By ("eventually reporting a successful resolution and bundle path" )
217
- Eventually (func (g Gomega ) {
218
- g .Expect (c .Get (ctx , types.NamespacedName {Name : operator .Name }, operator )).To (Succeed ())
219
- cond := apimeta .FindStatusCondition (operator .Status .Conditions , operatorv1alpha1 .TypeResolved )
220
- g .Expect (cond ).ToNot (BeNil ())
221
- g .Expect (cond .Reason ).To (Equal (operatorv1alpha1 .ReasonSuccess ))
222
- g .Expect (cond .Message ).To (ContainSubstring ("resolved to" ))
223
- g .Expect (operator .Status .ResolvedBundleResource ).ToNot (BeEmpty ())
224
- }).Should (Succeed ())
218
+ It ("does allow to upgrade the Operator to any of the successor versions within non-zero major version" , func () {
219
+ By ("updating the Operator resource by skipping versions" )
220
+ // Test catalog has versions between the initial version and new version
221
+ operator .Spec .Version = "1.2.0"
222
+ Expect (c .Update (ctx , operator )).To (Succeed ())
223
+ By ("eventually reporting a successful resolution and bundle path" )
224
+ Eventually (func (g Gomega ) {
225
+ g .Expect (c .Get (ctx , types.NamespacedName {Name : operator .Name }, operator )).To (Succeed ())
226
+ cond := apimeta .FindStatusCondition (operator .Status .Conditions , operatorv1alpha1 .TypeResolved )
227
+ g .Expect (cond ).ToNot (BeNil ())
228
+ g .Expect (cond .Reason ).To (Equal (operatorv1alpha1 .ReasonSuccess ))
229
+ g .Expect (cond .Message ).To (ContainSubstring ("resolved to" ))
230
+ g .Expect (operator .Status .ResolvedBundleResource ).To (Equal ("localhost/testdata/bundles/registry-v1/prometheus-operator:v1.2.0" ))
231
+ }).Should (Succeed ())
232
+ })
225
233
})
226
234
227
235
AfterEach (func () {
0 commit comments