@@ -64,11 +64,11 @@ var _ = Describe("Operator", func() {
64
64
// 8. Ensure o's status.components.refs field eventually contains references to sa-a and sa-b
65
65
// 9. Remove the component label from sa-b
66
66
// 10. Ensure the reference to sa-b is eventually removed from o's status.components.refs field
67
- // 11. Delete ns-a
68
- // 12. Ensure the reference to ns-a is eventually removed from o's status.components.refs field
69
- // 13. Delete o
70
- // 14. Ensure o is re-created
71
- // 15. Delete ns-b and o
67
+ // 11. Delete o
68
+ // 12. Ensure o is re-created
69
+ // 13. Delete ns-a
70
+ // 14. Ensure the reference to ns-a is eventually removed from o's status.components.refs field
71
+ // 15. Delete o
72
72
// 16. Ensure o is not re-created
73
73
It ("should surface components in its status" , func () {
74
74
o := & operatorsv1.Operator {}
@@ -188,19 +188,6 @@ var _ = Describe("Operator", func() {
188
188
By ("removing a component's reference when it no longer bears the component label" )
189
189
componentRefEventuallyExists (w , false , getReference (scheme , saB ))
190
190
191
- // Delete ns-a
192
- Eventually (func () error {
193
- err := client .Delete (clientCtx , nsA )
194
- if apierrors .IsNotFound (err ) {
195
- return nil
196
- }
197
- return err
198
- }).Should (Succeed ())
199
-
200
- // Ensure the reference to ns-a is eventually removed from o's status.components.refs field
201
- By ("removing a component's reference when it no longer exists" )
202
- componentRefEventuallyExists (w , false , getReference (scheme , nsA ))
203
-
204
191
// Delete o
205
192
Eventually (func () error {
206
193
err := client .Delete (clientCtx , o )
@@ -216,23 +203,37 @@ var _ = Describe("Operator", func() {
216
203
return client .Get (clientCtx , types.NamespacedName {Name : o .GetName ()}, o )
217
204
}).Should (Succeed ())
218
205
219
- // Delete ns-b and o
206
+ // Delete ns-a
220
207
Eventually (func () error {
221
- if err := client .Delete (clientCtx , nsB ); err != nil && ! apierrors .IsNotFound (err ) {
222
- return err
208
+ err := client .Delete (clientCtx , nsA )
209
+ if apierrors .IsNotFound (err ) {
210
+ return nil
223
211
}
224
- if err := client .Delete (clientCtx , o ); err != nil && ! apierrors .IsNotFound (err ) {
225
- return err
212
+ return err
213
+ }).Should (Succeed ())
214
+
215
+ // Ensure the reference to ns-a is eventually removed from o's status.components.refs field
216
+ By ("removing a component's reference when it no longer exists" )
217
+ componentRefEventuallyExists (w , false , getReference (scheme , nsA ))
218
+
219
+ // Delete o
220
+ Eventually (func () error {
221
+ err := client .Delete (clientCtx , o )
222
+ if apierrors .IsNotFound (err ) {
223
+ return nil
226
224
}
227
- return nil
225
+ return err
228
226
}).Should (Succeed ())
229
227
230
228
// Ensure that o is consistently not found
231
229
By ("verifying the Operator is permanently deleted if it has no components" )
232
- Consistently (func () bool {
230
+ Consistently (func () error {
233
231
err := client .Get (clientCtx , types.NamespacedName {Name : o .GetName ()}, o )
234
- return apierrors .IsNotFound (err )
235
- }).Should (BeTrue ())
232
+ if apierrors .IsNotFound (err ) {
233
+ return nil
234
+ }
235
+ return err
236
+ }).Should (Succeed ())
236
237
})
237
238
238
239
Context ("when a subscription to a package exists" , func () {
0 commit comments