@@ -10,7 +10,6 @@ import (
10
10
catalogd "github.com/operator-framework/catalogd/pkg/apis/core/v1beta1"
11
11
operatorv1alpha1 "github.com/operator-framework/operator-controller/api/v1alpha1"
12
12
rukpakv1alpha1 "github.com/operator-framework/rukpak/api/v1alpha1"
13
- "k8s.io/apimachinery/pkg/api/errors"
14
13
apimeta "k8s.io/apimachinery/pkg/api/meta"
15
14
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
16
15
"k8s.io/apimachinery/pkg/types"
@@ -58,8 +57,6 @@ var _ = Describe("Operator Install", func() {
58
57
},
59
58
},
60
59
}
61
- })
62
- It ("resolves the specified package with correct bundle path" , func () {
63
60
err := c .Create (ctx , operatorCatalog )
64
61
Expect (err ).ToNot (HaveOccurred ())
65
62
Eventually (func (g Gomega ) {
@@ -72,9 +69,10 @@ var _ = Describe("Operator Install", func() {
72
69
g .Expect (cond .Reason ).To (Equal (catalogd .ReasonUnpackSuccessful ))
73
70
g .Expect (cond .Message ).To (ContainSubstring ("successfully unpacked the catalog image" ))
74
71
}).WithTimeout (5 * time .Minute ).WithPolling (defaultPoll ).Should (Succeed ())
75
-
72
+ })
73
+ It ("resolves the specified package with correct bundle path" , func () {
76
74
By ("creating the Operator resource" )
77
- err = c .Create (ctx , operator )
75
+ err : = c .Create (ctx , operator )
78
76
Expect (err ).ToNot (HaveOccurred ())
79
77
80
78
By ("eventually reporting a successful resolution and bundle path" )
@@ -115,86 +113,12 @@ var _ = Describe("Operator Install", func() {
115
113
g .Expect (cond .Reason ).To (Equal (rukpakv1alpha1 .ReasonInstallationSucceeded ))
116
114
}).WithTimeout (defaultTimeout ).WithPolling (defaultPoll ).Should (Succeed ())
117
115
})
118
- It ("resolves again when a new catalog is available" , func () {
119
- Eventually (func (g Gomega ) {
120
- // target package should not be present on cluster
121
- err := c .Get (ctx , types.NamespacedName {Name : pkgName }, & catalogd.Package {})
122
- Expect (errors .IsNotFound (err )).To (BeTrue ())
123
- }).WithTimeout (5 * time .Minute ).WithPolling (defaultPoll ).Should (Succeed ())
124
-
125
- By ("creating the Operator resource" )
126
- err := c .Create (ctx , operator )
127
- Expect (err ).ToNot (HaveOccurred ())
128
-
129
- By ("failing to find Operator during resolution" )
130
- Eventually (func (g Gomega ) {
131
- err = c .Get (ctx , types.NamespacedName {Name : operator .Name }, operator )
132
- g .Expect (err ).ToNot (HaveOccurred ())
133
- cond := apimeta .FindStatusCondition (operator .Status .Conditions , operatorv1alpha1 .TypeResolved )
134
- g .Expect (cond ).ToNot (BeNil ())
135
- g .Expect (cond .Status ).To (Equal (metav1 .ConditionFalse ))
136
- g .Expect (cond .Reason ).To (Equal (operatorv1alpha1 .ReasonResolutionFailed ))
137
- g .Expect (cond .Message ).To (Equal (fmt .Sprintf ("package '%s' not found" , pkgName )))
138
- }).WithTimeout (defaultTimeout ).WithPolling (defaultPoll ).Should (Succeed ())
139
-
140
- By ("creating an Operator catalog with the desired package" )
141
- err = c .Create (ctx , operatorCatalog )
142
- Expect (err ).ToNot (HaveOccurred ())
143
- Eventually (func (g Gomega ) {
144
- err = c .Get (ctx , types.NamespacedName {Name : operatorCatalog .Name }, operatorCatalog )
145
- g .Expect (err ).ToNot (HaveOccurred ())
146
- cond := apimeta .FindStatusCondition (operatorCatalog .Status .Conditions , catalogd .TypeUnpacked )
147
- g .Expect (cond ).ToNot (BeNil ())
148
- g .Expect (cond .Status ).To (Equal (metav1 .ConditionTrue ))
149
- g .Expect (cond .Reason ).To (Equal (catalogd .ReasonUnpackSuccessful ))
150
- }).WithTimeout (5 * time .Minute ).WithPolling (defaultPoll ).Should (Succeed ())
151
-
152
- By ("eventually resolving the package successfully" )
153
- Eventually (func (g Gomega ) {
154
- err = c .Get (ctx , types.NamespacedName {Name : operator .Name }, operator )
155
- g .Expect (err ).ToNot (HaveOccurred ())
156
- cond := apimeta .FindStatusCondition (operator .Status .Conditions , operatorv1alpha1 .TypeResolved )
157
- g .Expect (cond ).ToNot (BeNil ())
158
- g .Expect (cond .Status ).To (Equal (metav1 .ConditionTrue ))
159
- g .Expect (cond .Reason ).To (Equal (operatorv1alpha1 .ReasonSuccess ))
160
- }).WithTimeout (defaultTimeout ).WithPolling (defaultPoll ).Should (Succeed ())
161
- })
162
116
AfterEach (func () {
163
117
err := c .Delete (ctx , operator )
164
118
Expect (err ).ToNot (HaveOccurred ())
165
- Eventually (func (g Gomega ) {
166
- err = c .Get (ctx , types.NamespacedName {Name : operatorName }, & operatorv1alpha1.Operator {})
167
- Expect (errors .IsNotFound (err )).To (BeTrue ())
168
- }).WithTimeout (defaultTimeout ).WithPolling (defaultPoll ).Should (Succeed ())
169
119
170
120
err = c .Delete (ctx , operatorCatalog )
171
121
Expect (err ).ToNot (HaveOccurred ())
172
- Eventually (func (g Gomega ) {
173
- err = c .Get (ctx , types.NamespacedName {Name : operatorCatalog .Name }, & catalogd.Catalog {})
174
- Expect (errors .IsNotFound (err )).To (BeTrue ())
175
- }).WithTimeout (defaultTimeout ).WithPolling (defaultPoll ).Should (Succeed ())
176
-
177
- // speed up delete without waiting for gc
178
- err = c .DeleteAllOf (ctx , & catalogd.BundleMetadata {})
179
- Expect (err ).ToNot (HaveOccurred ())
180
- err = c .DeleteAllOf (ctx , & catalogd.Package {})
181
- Expect (err ).ToNot (HaveOccurred ())
182
-
183
- Eventually (func (g Gomega ) {
184
- // ensure resource cleanup
185
- packages := & catalogd.PackageList {}
186
- err = c .List (ctx , packages )
187
- Expect (err ).To (BeNil ())
188
- Expect (packages .Items ).To (BeEmpty ())
189
-
190
- bmd := & catalogd.BundleMetadataList {}
191
- err = c .List (ctx , bmd )
192
- Expect (err ).To (BeNil ())
193
- Expect (bmd .Items ).To (BeEmpty ())
194
-
195
- err = c .Get (ctx , types.NamespacedName {Name : operatorName }, & rukpakv1alpha1.BundleDeployment {})
196
- Expect (errors .IsNotFound (err )).To (BeTrue ())
197
- }).WithTimeout (5 * time .Minute ).WithPolling (defaultPoll ).Should (Succeed ())
198
122
})
199
123
})
200
124
})
0 commit comments