Skip to content

Commit 035683f

Browse files
committed
fix e2e test order
1 parent d90349f commit 035683f

File tree

1 file changed

+28
-27
lines changed

1 file changed

+28
-27
lines changed

test/e2e/operator_test.go

Lines changed: 28 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -64,11 +64,11 @@ var _ = Describe("Operator", func() {
6464
// 8. Ensure o's status.components.refs field eventually contains references to sa-a and sa-b
6565
// 9. Remove the component label from sa-b
6666
// 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
7272
// 16. Ensure o is not re-created
7373
It("should surface components in its status", func() {
7474
o := &operatorsv1.Operator{}
@@ -188,19 +188,6 @@ var _ = Describe("Operator", func() {
188188
By("removing a component's reference when it no longer bears the component label")
189189
componentRefEventuallyExists(w, false, getReference(scheme, saB))
190190

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-
204191
// Delete o
205192
Eventually(func() error {
206193
err := client.Delete(clientCtx, o)
@@ -216,23 +203,37 @@ var _ = Describe("Operator", func() {
216203
return client.Get(clientCtx, types.NamespacedName{Name: o.GetName()}, o)
217204
}).Should(Succeed())
218205

219-
// Delete ns-b and o
206+
// Delete ns-a
220207
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
223211
}
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
226224
}
227-
return nil
225+
return err
228226
}).Should(Succeed())
229227

230228
// Ensure that o is consistently not found
231229
By("verifying the Operator is permanently deleted if it has no components")
232-
Consistently(func() bool {
230+
Consistently(func() error {
233231
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())
236237
})
237238

238239
Context("when a subscription to a package exists", func() {

0 commit comments

Comments
 (0)