@@ -50,6 +50,7 @@ var _ = Describe("GitOps Operator Parallel E2E Tests", func() {
5050 ns * corev1.Namespace
5151 cleanupFunc func ()
5252 imageUpdater * imageUpdaterApi.ImageUpdater
53+ argoCD * argov1beta1api.ArgoCD
5354 )
5455
5556 BeforeEach (func () {
@@ -63,7 +64,16 @@ var _ = Describe("GitOps Operator Parallel E2E Tests", func() {
6364 if imageUpdater != nil {
6465 By ("deleting ImageUpdater CR" )
6566 Expect (k8sClient .Delete (ctx , imageUpdater )).To (Succeed ())
66- Eventually (imageUpdater ).Should (k8sFixture .NotExistByName ())
67+ Eventually (imageUpdater , "2m" , "5s" ).Should (k8sFixture .NotExistByName ())
68+ }
69+
70+ // Delete the ArgoCD CR before namespace deletion to allow the operator
71+ // to properly clean up all managed resources. This prevents finalizer
72+ // issues and rate limiting during cleanup in CI environments.
73+ if argoCD != nil {
74+ By ("deleting ArgoCD CR" )
75+ Expect (k8sClient .Delete (ctx , argoCD )).To (Succeed ())
76+ Eventually (argoCD , "5m" , "10s" ).Should (k8sFixture .NotExistByName ())
6777 }
6878
6979 if cleanupFunc != nil {
@@ -79,7 +89,7 @@ var _ = Describe("GitOps Operator Parallel E2E Tests", func() {
7989 By ("creating simple namespace-scoped Argo CD instance with image updater enabled" )
8090 ns , cleanupFunc = fixture .CreateRandomE2ETestNamespaceWithCleanupFunc ()
8191
82- argoCD : = & argov1beta1api.ArgoCD {
92+ argoCD = & argov1beta1api.ArgoCD {
8393 ObjectMeta : metav1.ObjectMeta {Name : "argocd" , Namespace : ns .Name },
8494 Spec : argov1beta1api.ArgoCDSpec {
8595 ImageUpdater : argov1beta1api.ArgoCDImageUpdaterSpec {
@@ -181,8 +191,6 @@ var _ = Describe("GitOps Operator Parallel E2E Tests", func() {
181191 // Return an empty string to signify the condition is not yet met.
182192 return ""
183193 }, "5m" , "10s" ).Should (Equal ("quay.io/dkarpele/my-guestbook:29437546.0" ))
184-
185- Expect (k8sClient .Delete (ctx , imageUpdater )).To (Succeed ())
186194 })
187195 })
188196})
0 commit comments