@@ -39,6 +39,7 @@ var _ = Describe("Operator Install", func() {
39
39
BeforeEach (func () {
40
40
operator .Spec = operatorv1alpha1.OperatorSpec {
41
41
PackageName : "prometheus" ,
42
+ Version : "0.47.0" ,
42
43
}
43
44
})
44
45
It ("resolves the specified package with correct bundle path" , func () {
@@ -167,6 +168,50 @@ var _ = Describe("Operator Install", func() {
167
168
}).Should (Succeed ())
168
169
})
169
170
171
+ It ("handles upgrade edges correctly" , func () {
172
+ By ("creating a valid Operator resource" )
173
+ operator .Spec = operatorv1alpha1.OperatorSpec {
174
+ PackageName : "prometheus" ,
175
+ Version : "0.37.0" ,
176
+ }
177
+ Expect (c .Create (ctx , operator )).To (Succeed ())
178
+ By ("eventually reporting a successful resolution" )
179
+ Eventually (func (g Gomega ) {
180
+ g .Expect (c .Get (ctx , types.NamespacedName {Name : operator .Name }, operator )).To (Succeed ())
181
+ cond := apimeta .FindStatusCondition (operator .Status .Conditions , operatorv1alpha1 .TypeResolved )
182
+ g .Expect (cond ).ToNot (BeNil ())
183
+ g .Expect (cond .Reason ).To (Equal (operatorv1alpha1 .ReasonSuccess ))
184
+ g .Expect (cond .Message ).To (ContainSubstring ("resolved to" ))
185
+ g .Expect (operator .Status .ResolvedBundleResource ).ToNot (BeEmpty ())
186
+ }).Should (Succeed ())
187
+
188
+ By ("updating the Operator resource to an invalid version" )
189
+ operator .Spec .Version = "0.65.1" // the correct one should be 0.47.0
190
+ Expect (c .Update (ctx , operator )).To (Succeed ())
191
+ By ("eventually reporting a failed 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 .ReasonResolutionFailed ))
197
+ g .Expect (cond .Message ).To (ContainSubstring ("entity for package \" prometheus\" not found in solutio" ))
198
+ g .Expect (operator .Status .ResolvedBundleResource ).To (BeEmpty ())
199
+ }).Should (Succeed ())
200
+
201
+ By ("updating the Operator resource to a valid upgrade edge" )
202
+ operator .Spec .Version = "0.47.0"
203
+ Expect (c .Update (ctx , operator )).To (Succeed ())
204
+ By ("eventually reporting a successful resolution and bundle path" )
205
+ Eventually (func (g Gomega ) {
206
+ g .Expect (c .Get (ctx , types.NamespacedName {Name : operator .Name }, operator )).To (Succeed ())
207
+ cond := apimeta .FindStatusCondition (operator .Status .Conditions , operatorv1alpha1 .TypeResolved )
208
+ g .Expect (cond ).ToNot (BeNil ())
209
+ g .Expect (cond .Reason ).To (Equal (operatorv1alpha1 .ReasonSuccess ))
210
+ g .Expect (cond .Message ).To (ContainSubstring ("resolved to" ))
211
+ g .Expect (operator .Status .ResolvedBundleResource ).ToNot (BeEmpty ())
212
+ }).Should (Succeed ())
213
+ })
214
+
170
215
AfterEach (func () {
171
216
Expect (c .Delete (ctx , operator )).To (Succeed ())
172
217
Eventually (func (g Gomega ) {
0 commit comments