9
9
. "github.com/onsi/gomega"
10
10
corev1 "k8s.io/api/core/v1"
11
11
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
12
+ "k8s.io/apimachinery/pkg/types"
12
13
"sigs.k8s.io/controller-runtime/pkg/client"
13
14
14
15
operatorsv1 "github.com/operator-framework/api/pkg/operators/v1"
@@ -27,6 +28,7 @@ var _ = Describe("Fail Forward Upgrades", func() {
27
28
ns corev1.Namespace
28
29
crclient versioned.Interface
29
30
c client.Client
31
+ ogName string
30
32
)
31
33
32
34
BeforeEach (func () {
@@ -45,6 +47,7 @@ var _ = Describe("Fail Forward Upgrades", func() {
45
47
},
46
48
}
47
49
ns = SetupGeneratedTestNamespaceWithOperatorGroup (namespaceName , og )
50
+ ogName = og .GetName ()
48
51
})
49
52
50
53
AfterEach (func () {
@@ -61,9 +64,9 @@ var _ = Describe("Fail Forward Upgrades", func() {
61
64
)
62
65
63
66
BeforeEach (func () {
67
+ By ("deploying the testing catalog" )
64
68
provider , err := NewFileBasedFiledBasedCatalogProvider (filepath .Join (testdataDir , failForwardTestDataBaseDir , "example-operator.v0.1.0.yaml" ))
65
69
Expect (err ).To (BeNil ())
66
-
67
70
catalogSourceName = genName ("mc-ip-failed-" )
68
71
magicCatalog = NewMagicCatalog (c , ns .GetName (), catalogSourceName , provider )
69
72
Expect (magicCatalog .DeployCatalog (context .Background ())).To (BeNil ())
@@ -93,6 +96,9 @@ var _ = Describe("Fail Forward Upgrades", func() {
93
96
_ , err = fetchCSV (crclient , subscription .Status .CurrentCSV , ns .GetName (), buildCSVConditionChecker (operatorsv1alpha1 .CSVPhaseSucceeded ))
94
97
Expect (err ).ShouldNot (HaveOccurred ())
95
98
99
+ By ("patching the OperatorGroup to reduce the bundle unpacking timeout" )
100
+ addBundleUnpackTimeoutOGAnnotation (context .Background (), c , types.NamespacedName {Name : ogName , Namespace : ns .GetName ()}, "1s" )
101
+
96
102
By ("updating the catalog with a broken v0.2.0 bundle image" )
97
103
brokenProvider , err := NewFileBasedFiledBasedCatalogProvider (filepath .Join (testdataDir , failForwardTestDataBaseDir , "example-operator.v0.2.0.yaml" ))
98
104
Expect (err ).To (BeNil ())
@@ -104,9 +110,6 @@ var _ = Describe("Fail Forward Upgrades", func() {
104
110
subscription , err = fetchSubscription (crclient , subscription .GetNamespace (), subscription .GetName (), subscriptionHasInstallPlanDifferentChecker (originalInstallPlanRef .Name ))
105
111
Expect (err ).Should (BeNil ())
106
112
107
- By ("patching the installplan to reduce the bundle unpacking timeout" )
108
- addBundleUnpackTimeoutIPAnnotation (context .Background (), c , objectRefToNamespacedName (subscription .Status .InstallPlanRef ), "1s" )
109
-
110
113
By ("waiting for the bad InstallPlan to report a failed installation state" )
111
114
ref := subscription .Status .InstallPlanRef
112
115
_ , err = fetchInstallPlan (GinkgoT (), crclient , ref .Name , ref .Namespace , buildInstallPlanPhaseCheckFunc (operatorsv1alpha1 .InstallPlanPhaseFailed ))
@@ -129,18 +132,17 @@ var _ = Describe("Fail Forward Upgrades", func() {
129
132
subscription , err = fetchSubscription (crclient , subscription .GetNamespace (), subscription .GetName (), subscriptionHasCurrentCSV ("example-operator.v0.2.1" ))
130
133
Expect (err ).Should (BeNil ())
131
134
132
- By ("patching the installplan to reduce the bundle unpacking timeout" )
133
- addBundleUnpackTimeoutIPAnnotation (context .Background (), c , objectRefToNamespacedName (subscription .Status .InstallPlanRef ), "1s" )
134
-
135
135
By ("waiting for the bad v0.2.1 InstallPlan to report a failed installation state" )
136
136
ref := subscription .Status .InstallPlanRef
137
137
_ , err = fetchInstallPlan (GinkgoT (), crclient , ref .Name , ref .Namespace , buildInstallPlanPhaseCheckFunc (operatorsv1alpha1 .InstallPlanPhaseFailed ))
138
138
Expect (err ).To (BeNil ())
139
139
140
+ By ("patching the OperatorGroup to increase the bundle unpacking timeout" )
141
+ addBundleUnpackTimeoutOGAnnotation (context .Background (), c , types.NamespacedName {Name : ogName , Namespace : ns .GetName ()}, "5m" )
142
+
140
143
By ("patching the catalog with a fixed version" )
141
144
fixedProvider , err := NewFileBasedFiledBasedCatalogProvider (filepath .Join (testdataDir , "fail-forward/multiple-bad-versions" , "example-operator.v0.3.0.yaml" ))
142
145
Expect (err ).To (BeNil ())
143
-
144
146
err = magicCatalog .UpdateCatalog (context .Background (), fixedProvider )
145
147
Expect (err ).To (BeNil ())
146
148
@@ -150,10 +152,12 @@ var _ = Describe("Fail Forward Upgrades", func() {
150
152
})
151
153
152
154
It ("eventually reports a successful state when using skip ranges" , func () {
155
+ By ("patching the OperatorGroup to increase the bundle unpacking timeout" )
156
+ addBundleUnpackTimeoutOGAnnotation (context .Background (), c , types.NamespacedName {Name : ogName , Namespace : ns .GetName ()}, "5m" )
157
+
153
158
By ("patching the catalog with a fixed version" )
154
159
fixedProvider , err := NewFileBasedFiledBasedCatalogProvider (filepath .Join (testdataDir , "fail-forward/skip-range" , "example-operator.v0.3.0.yaml" ))
155
160
Expect (err ).To (BeNil ())
156
-
157
161
err = magicCatalog .UpdateCatalog (context .Background (), fixedProvider )
158
162
Expect (err ).To (BeNil ())
159
163
@@ -162,10 +166,12 @@ var _ = Describe("Fail Forward Upgrades", func() {
162
166
Expect (err ).Should (BeNil ())
163
167
})
164
168
It ("eventually reports a successful state when using skips" , func () {
169
+ By ("patching the OperatorGroup to increase the bundle unpacking timeout" )
170
+ addBundleUnpackTimeoutOGAnnotation (context .Background (), c , types.NamespacedName {Name : ogName , Namespace : ns .GetName ()}, "5m" )
171
+
165
172
By ("patching the catalog with a fixed version" )
166
173
fixedProvider , err := NewFileBasedFiledBasedCatalogProvider (filepath .Join (testdataDir , "fail-forward/skips" , "example-operator.v0.3.0.yaml" ))
167
174
Expect (err ).To (BeNil ())
168
-
169
175
err = magicCatalog .UpdateCatalog (context .Background (), fixedProvider )
170
176
Expect (err ).To (BeNil ())
171
177
@@ -174,10 +180,12 @@ var _ = Describe("Fail Forward Upgrades", func() {
174
180
Expect (err ).Should (BeNil ())
175
181
})
176
182
It ("eventually reports a failed state when using replaces" , func () {
183
+ By ("patching the OperatorGroup to increase the bundle unpacking timeout" )
184
+ addBundleUnpackTimeoutOGAnnotation (context .Background (), c , types.NamespacedName {Name : ogName , Namespace : ns .GetName ()}, "5m" )
185
+
177
186
By ("patching the catalog with a fixed version" )
178
187
fixedProvider , err := NewFileBasedFiledBasedCatalogProvider (filepath .Join (testdataDir , "fail-forward/replaces" , "example-operator.v0.3.0.yaml" ))
179
188
Expect (err ).To (BeNil ())
180
-
181
189
err = magicCatalog .UpdateCatalog (context .Background (), fixedProvider )
182
190
Expect (err ).To (BeNil ())
183
191
@@ -200,9 +208,9 @@ var _ = Describe("Fail Forward Upgrades", func() {
200
208
)
201
209
202
210
BeforeEach (func () {
211
+ By ("deploying the testing catalog" )
203
212
provider , err := NewFileBasedFiledBasedCatalogProvider (filepath .Join (testdataDir , failForwardTestDataBaseDir , "example-operator.v0.1.0.yaml" ))
204
213
Expect (err ).To (BeNil ())
205
-
206
214
catalogSourceName = genName ("mc-csv-failed-" )
207
215
magicCatalog = NewMagicCatalog (c , ns .GetName (), catalogSourceName , provider )
208
216
Expect (magicCatalog .DeployCatalog (context .Background ())).To (BeNil ())
0 commit comments