@@ -55,12 +55,13 @@ var _ = Describe("Fail Forward Upgrades", func() {
55
55
TeardownNamespace (ns .GetName ())
56
56
})
57
57
58
- When ("an InstallPlan is reporting a failed state " , func () {
58
+ When ("InstallPlan is not being created due to failed upgrade " , func () {
59
59
60
60
var (
61
- magicCatalog * MagicCatalog
62
- catalogSourceName string
63
- subscription * operatorsv1alpha1.Subscription
61
+ magicCatalog * MagicCatalog
62
+ catalogSourceName string
63
+ subscription * operatorsv1alpha1.Subscription
64
+ originalInstallPlanRef * corev1.ObjectReference
64
65
)
65
66
66
67
BeforeEach (func () {
@@ -90,7 +91,7 @@ var _ = Describe("Fail Forward Upgrades", func() {
90
91
subscription , err := fetchSubscription (crclient , subscription .GetNamespace (), subscription .GetName (), subscriptionHasInstallPlanChecker )
91
92
Expect (err ).Should (BeNil ())
92
93
93
- originalInstallPlanRef : = subscription .Status .InstallPlanRef
94
+ originalInstallPlanRef = subscription .Status .InstallPlanRef
94
95
95
96
By ("waiting for the v0.1.0 CSV to report a succeeded phase" )
96
97
_ , err = fetchCSV (crclient , subscription .Status .CurrentCSV , ns .GetName (), buildCSVConditionChecker (operatorsv1alpha1 .CSVPhaseSucceeded ))
@@ -102,40 +103,30 @@ var _ = Describe("Fail Forward Upgrades", func() {
102
103
By ("updating the catalog with a broken v0.2.0 bundle image" )
103
104
brokenProvider , err := NewFileBasedFiledBasedCatalogProvider (filepath .Join (testdataDir , failForwardTestDataBaseDir , "example-operator.v0.2.0.yaml" ))
104
105
Expect (err ).To (BeNil ())
105
-
106
106
err = magicCatalog .UpdateCatalog (context .Background (), brokenProvider )
107
107
Expect (err ).To (BeNil ())
108
108
109
- By ("verifying the subscription is referencing a new installplan" )
110
- subscription , err = fetchSubscription (crclient , subscription .GetNamespace (), subscription .GetName (), subscriptionHasInstallPlanDifferentChecker (originalInstallPlanRef .Name ))
111
- Expect (err ).Should (BeNil ())
112
-
113
- By ("waiting for the bad InstallPlan to report a failed installation state" )
114
- ref := subscription .Status .InstallPlanRef
115
- _ , err = fetchInstallPlan (GinkgoT (), crclient , ref .Name , ref .Namespace , buildInstallPlanPhaseCheckFunc (operatorsv1alpha1 .InstallPlanPhaseFailed ))
116
- Expect (err ).To (BeNil ())
109
+ By ("waiting for the subscription to maintain the example-operator.v0.1.0 status.currentCSV" )
110
+ Consistently (subscriptionCurrentCSVGetter (crclient , subscription .GetNamespace (), subscription .GetName ())).Should (Equal ("example-operator.v0.1.0" ))
117
111
112
+ By ("verifying the subscription is referencing the same InstallPlan" )
113
+ subscription , err = fetchSubscription (crclient , subscription .GetNamespace (), subscription .GetName (), subscriptionHasInstallPlanChecker )
114
+ Expect (err ).Should (BeNil ())
115
+ Expect (subscription .Status .InstallPlanRef .Name ).To (Equal (originalInstallPlanRef .Name ))
118
116
})
119
117
AfterEach (func () {
120
118
By ("removing the testing catalog resources" )
121
119
Expect (magicCatalog .UndeployCatalog (context .Background ())).To (BeNil ())
122
120
})
123
- It ("eventually reports a successful state when multiple bad versions are rolled forward" , func () {
121
+ It ("eventually gets created and reports a successful state when multiple bad versions are rolled forward" , func () {
124
122
By ("patching the catalog with another bad bundle version" )
125
123
badProvider , err := NewFileBasedFiledBasedCatalogProvider (filepath .Join (testdataDir , "fail-forward/multiple-bad-versions" , "example-operator.v0.2.1.yaml" ))
126
124
Expect (err ).To (BeNil ())
127
-
128
125
err = magicCatalog .UpdateCatalog (context .Background (), badProvider )
129
126
Expect (err ).To (BeNil ())
130
127
131
- By ("waiting for the subscription to have the example-operator.v0.2.1 status.updatedCSV" )
132
- subscription , err = fetchSubscription (crclient , subscription .GetNamespace (), subscription .GetName (), subscriptionHasCurrentCSV ("example-operator.v0.2.1" ))
133
- Expect (err ).Should (BeNil ())
134
-
135
- By ("waiting for the bad v0.2.1 InstallPlan to report a failed installation state" )
136
- ref := subscription .Status .InstallPlanRef
137
- _ , err = fetchInstallPlan (GinkgoT (), crclient , ref .Name , ref .Namespace , buildInstallPlanPhaseCheckFunc (operatorsv1alpha1 .InstallPlanPhaseFailed ))
138
- Expect (err ).To (BeNil ())
128
+ By ("waiting for the subscription to maintain the example-operator.v0.1.0 status.currentCSV" )
129
+ Consistently (subscriptionCurrentCSVGetter (crclient , subscription .GetNamespace (), subscription .GetName ())).Should (Equal ("example-operator.v0.1.0" ))
139
130
140
131
By ("patching the OperatorGroup to increase the bundle unpacking timeout" )
141
132
addBundleUnpackTimeoutOGAnnotation (context .Background (), c , types.NamespacedName {Name : ogName , Namespace : ns .GetName ()}, "5m" )
@@ -146,12 +137,21 @@ var _ = Describe("Fail Forward Upgrades", func() {
146
137
err = magicCatalog .UpdateCatalog (context .Background (), fixedProvider )
147
138
Expect (err ).To (BeNil ())
148
139
149
- By ("waiting for the subscription to have the example-operator.v0.3.0 status.updatedCSV " )
150
- subscription , err = fetchSubscription (crclient , subscription .GetNamespace (), subscription .GetName (), subscriptionHasCurrentCSV ("example-operator.v0.3.0" ))
140
+ By ("waiting for the subscription to have the example-operator.v0.3.0 status.currentCSV " )
141
+ _ , err = fetchSubscription (crclient , subscription .GetNamespace (), subscription .GetName (), subscriptionHasCurrentCSV ("example-operator.v0.3.0" ))
151
142
Expect (err ).Should (BeNil ())
143
+
144
+ By ("verifying the subscription is referencing a new InstallPlan" )
145
+ subscription , err = fetchSubscription (crclient , subscription .GetNamespace (), subscription .GetName (), subscriptionHasInstallPlanDifferentChecker (originalInstallPlanRef .Name ))
146
+ Expect (err ).Should (BeNil ())
147
+
148
+ By ("waiting for the fixed v0.3.0 InstallPlan to report a successful state" )
149
+ ref := subscription .Status .InstallPlanRef
150
+ _ , err = fetchInstallPlan (GinkgoT (), crclient , ref .Name , ref .Namespace , buildInstallPlanPhaseCheckFunc (operatorsv1alpha1 .InstallPlanPhaseComplete ))
151
+ Expect (err ).To (BeNil ())
152
152
})
153
153
154
- It ("eventually reports a successful state when using skip ranges" , func () {
154
+ It ("eventually gets created and reports a successful state when using skip ranges" , func () {
155
155
By ("patching the OperatorGroup to increase the bundle unpacking timeout" )
156
156
addBundleUnpackTimeoutOGAnnotation (context .Background (), c , types.NamespacedName {Name : ogName , Namespace : ns .GetName ()}, "5m" )
157
157
@@ -161,11 +161,20 @@ var _ = Describe("Fail Forward Upgrades", func() {
161
161
err = magicCatalog .UpdateCatalog (context .Background (), fixedProvider )
162
162
Expect (err ).To (BeNil ())
163
163
164
- By ("waiting for the subscription to have the example-operator.v0.3.0 status.updatedCSV" )
165
- subscription , err = fetchSubscription (crclient , subscription .GetNamespace (), subscription .GetName (), subscriptionHasCurrentCSV ("example-operator.v0.3.0" ))
164
+ By ("waiting for the subscription to have the example-operator.v0.3.0 status.currentCSV" )
165
+ _ , err = fetchSubscription (crclient , subscription .GetNamespace (), subscription .GetName (), subscriptionHasCurrentCSV ("example-operator.v0.3.0" ))
166
+ Expect (err ).Should (BeNil ())
167
+
168
+ By ("verifying the subscription is referencing a new InstallPlan" )
169
+ subscription , err = fetchSubscription (crclient , subscription .GetNamespace (), subscription .GetName (), subscriptionHasInstallPlanDifferentChecker (originalInstallPlanRef .Name ))
166
170
Expect (err ).Should (BeNil ())
171
+
172
+ By ("waiting for the fixed v0.3.0 InstallPlan to report a successful state" )
173
+ ref := subscription .Status .InstallPlanRef
174
+ _ , err = fetchInstallPlan (GinkgoT (), crclient , ref .Name , ref .Namespace , buildInstallPlanPhaseCheckFunc (operatorsv1alpha1 .InstallPlanPhaseComplete ))
175
+ Expect (err ).To (BeNil ())
167
176
})
168
- It ("eventually reports a successful state when using skips" , func () {
177
+ It ("eventually gets created and reports a successful state when using skips" , func () {
169
178
By ("patching the OperatorGroup to increase the bundle unpacking timeout" )
170
179
addBundleUnpackTimeoutOGAnnotation (context .Background (), c , types.NamespacedName {Name : ogName , Namespace : ns .GetName ()}, "5m" )
171
180
@@ -175,11 +184,20 @@ var _ = Describe("Fail Forward Upgrades", func() {
175
184
err = magicCatalog .UpdateCatalog (context .Background (), fixedProvider )
176
185
Expect (err ).To (BeNil ())
177
186
178
- By ("waiting for the subscription to have the example-operator.v0.3.0 status.updatedCSV" )
179
- subscription , err = fetchSubscription (crclient , subscription .GetNamespace (), subscription .GetName (), subscriptionHasCurrentCSV ("example-operator.v0.3.0" ))
187
+ By ("waiting for the subscription to have the example-operator.v0.3.0 status.currentCSV" )
188
+ _ , err = fetchSubscription (crclient , subscription .GetNamespace (), subscription .GetName (), subscriptionHasCurrentCSV ("example-operator.v0.3.0" ))
189
+ Expect (err ).Should (BeNil ())
190
+
191
+ By ("verifying the subscription is referencing a new InstallPlan" )
192
+ subscription , err = fetchSubscription (crclient , subscription .GetNamespace (), subscription .GetName (), subscriptionHasInstallPlanDifferentChecker (originalInstallPlanRef .Name ))
180
193
Expect (err ).Should (BeNil ())
194
+
195
+ By ("waiting for the fixed v0.3.0 InstallPlan to report a successful state" )
196
+ ref := subscription .Status .InstallPlanRef
197
+ _ , err = fetchInstallPlan (GinkgoT (), crclient , ref .Name , ref .Namespace , buildInstallPlanPhaseCheckFunc (operatorsv1alpha1 .InstallPlanPhaseComplete ))
198
+ Expect (err ).To (BeNil ())
181
199
})
182
- It ("eventually reports a failed state when using replaces" , func () {
200
+ It ("never gets created when using replaces" , func () {
183
201
By ("patching the OperatorGroup to increase the bundle unpacking timeout" )
184
202
addBundleUnpackTimeoutOGAnnotation (context .Background (), c , types.NamespacedName {Name : ogName , Namespace : ns .GetName ()}, "5m" )
185
203
@@ -189,14 +207,13 @@ var _ = Describe("Fail Forward Upgrades", func() {
189
207
err = magicCatalog .UpdateCatalog (context .Background (), fixedProvider )
190
208
Expect (err ).To (BeNil ())
191
209
192
- By ("waiting for the subscription to maintain the example-operator.v0.2.0 status.updatedCSV" )
193
- Consistently (func () string {
194
- subscription , err := crclient .OperatorsV1alpha1 ().Subscriptions (subscription .GetNamespace ()).Get (context .Background (), subscription .GetName (), metav1.GetOptions {})
195
- if err != nil || subscription == nil {
196
- return ""
197
- }
198
- return subscription .Status .CurrentCSV
199
- }).Should (Equal ("example-operator.v0.2.0" ))
210
+ By ("waiting for the subscription to maintain the example-operator.v0.2.0 status.currentCSV" )
211
+ Consistently (subscriptionCurrentCSVGetter (crclient , subscription .GetNamespace (), subscription .GetName ())).Should (Equal ("example-operator.v0.1.0" ))
212
+
213
+ By ("verifying the subscription is referencing the same InstallPlan" )
214
+ subscription , err = fetchSubscription (crclient , subscription .GetNamespace (), subscription .GetName (), subscriptionHasInstallPlanChecker )
215
+ Expect (err ).Should (BeNil ())
216
+ Expect (subscription .Status .InstallPlanRef .Name ).To (Equal (originalInstallPlanRef .Name ))
200
217
})
201
218
})
202
219
When ("a CSV resource is in a failed state" , func () {
@@ -269,7 +286,7 @@ var _ = Describe("Fail Forward Upgrades", func() {
269
286
err = magicCatalog .UpdateCatalog (context .Background (), fixedProvider )
270
287
Expect (err ).To (BeNil ())
271
288
272
- By ("waiting for the subscription to have the example-operator.v0.3.0 status.updatedCSV " )
289
+ By ("waiting for the subscription to have the example-operator.v0.3.0 status.currentCSV " )
273
290
subscription , err = fetchSubscription (crclient , subscription .GetNamespace (), subscription .GetName (), subscriptionHasCurrentCSV ("example-operator.v0.3.0" ))
274
291
Expect (err ).Should (BeNil ())
275
292
})
@@ -282,7 +299,7 @@ var _ = Describe("Fail Forward Upgrades", func() {
282
299
err = magicCatalog .UpdateCatalog (context .Background (), fixedProvider )
283
300
Expect (err ).To (BeNil ())
284
301
285
- By ("waiting for the subscription to have the example-operator.v0.3.0 status.updatedCSV " )
302
+ By ("waiting for the subscription to have the example-operator.v0.3.0 status.currentCSV " )
286
303
subscription , err = fetchSubscription (crclient , subscription .GetNamespace (), subscription .GetName (), subscriptionHasCurrentCSV ("example-operator.v0.3.0" ))
287
304
Expect (err ).Should (BeNil ())
288
305
})
@@ -295,7 +312,7 @@ var _ = Describe("Fail Forward Upgrades", func() {
295
312
err = magicCatalog .UpdateCatalog (context .Background (), fixedProvider )
296
313
Expect (err ).To (BeNil ())
297
314
298
- By ("waiting for the subscription to have the example-operator.v0.3.0 status.updatedCSV " )
315
+ By ("waiting for the subscription to have the example-operator.v0.3.0 status.currentCSV " )
299
316
subscription , err = fetchSubscription (crclient , subscription .GetNamespace (), subscription .GetName (), subscriptionHasCurrentCSV ("example-operator.v0.3.0" ))
300
317
Expect (err ).Should (BeNil ())
301
318
})
0 commit comments