From 3c50570942a0650dfe7cc59e0453c43e78877333 Mon Sep 17 00:00:00 2001 From: Jonathan West Date: Fri, 30 Jan 2026 09:01:10 -0500 Subject: [PATCH 1/3] chore: fix intermittent fail in 1-040 Signed-off-by: Jonathan West --- ...0_validate_quoted_RBAC_group_names_test.go | 34 +++++++++++++++---- 1 file changed, 27 insertions(+), 7 deletions(-) diff --git a/test/openshift/e2e/ginkgo/sequential/1-040_validate_quoted_RBAC_group_names_test.go b/test/openshift/e2e/ginkgo/sequential/1-040_validate_quoted_RBAC_group_names_test.go index 3263a162e..7dcb095fb 100644 --- a/test/openshift/e2e/ginkgo/sequential/1-040_validate_quoted_RBAC_group_names_test.go +++ b/test/openshift/e2e/ginkgo/sequential/1-040_validate_quoted_RBAC_group_names_test.go @@ -1,6 +1,8 @@ package sequential import ( + "strings" + . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" "github.com/redhat-developer/gitops-operator/test/openshift/e2e/ginkgo/fixture" @@ -16,11 +18,24 @@ var _ = Describe("GitOps Operator Sequential E2E Tests", func() { }) AfterEach(func() { + + // Delete the new role we created during the test + defer func() { + By("deleting the role we created during the test") + _, err := argocdFixture.RunArgoCDCLI("proj", "role", "delete", "default", "somerole") + Expect(err).ToNot(HaveOccurred()) + }() + fixture.OutputDebugOnFail() + }) It("creates a project role 'somerole' and group claim, and verifies group claim contains the expected data", func() { + defaultArgoCD, err := argocdFixture.GetOpenShiftGitOpsNSArgoCD() + Expect(err).ToNot(HaveOccurred()) + Eventually(defaultArgoCD, "5m", "5s").Should(argocdFixture.BeAvailable()) + By("logging in to Argo CD instance") Expect(argocdFixture.LogInToDefaultArgoCDInstance()).To(Succeed()) @@ -28,15 +43,20 @@ var _ = Describe("GitOps Operator Sequential E2E Tests", func() { output, err := argocdFixture.RunArgoCDCLI("proj", "role", "create", "default", "somerole") Expect(err).ToNot(HaveOccurred()) - // Delete the new role we created during the test - defer func() { - By("deleting the role we created during the test") - _, err = argocdFixture.RunArgoCDCLI("proj", "role", "delete", "default", "somerole") - Expect(err).ToNot(HaveOccurred()) - }() - Expect(output).To(ContainSubstring("Role 'somerole' created")) + By("waiting for Argo CD to verify the role exists before we add to it (there seems to be some kind of intermittent race condition here in Argo CD itself, where create succeeds in the previous step, but we received 503 in the next step)") + Eventually(func() bool { + output, err := argocdFixture.RunArgoCDCLI("proj", "role", "get", "default", "somerole") + if err != nil { + GinkgoWriter.Println("error:", err) + return false + } + + return strings.Contains(output, "Role Name:") + + }, "30s", "5s").Should(BeTrue()) + By("adding a group claim to the somerole role") output, err = argocdFixture.RunArgoCDCLI("proj", "role", "add-group", "default", "somerole", "\"CN=foo,OU=bar,O=baz\"") Expect(err).ToNot(HaveOccurred()) From 34c8feb03728595d648c5f226ef57ad5a906f96d Mon Sep 17 00:00:00 2001 From: Jonathan West Date: Mon, 2 Feb 2026 14:56:02 -0500 Subject: [PATCH 2/3] chore: increase timeout on waiting for nginx deployment on 1-027 Signed-off-by: Jonathan West --- .../sequential/1-027_validate_operand_from_git_test.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/test/openshift/e2e/ginkgo/sequential/1-027_validate_operand_from_git_test.go b/test/openshift/e2e/ginkgo/sequential/1-027_validate_operand_from_git_test.go index 3a16a48fb..2e808ef33 100644 --- a/test/openshift/e2e/ginkgo/sequential/1-027_validate_operand_from_git_test.go +++ b/test/openshift/e2e/ginkgo/sequential/1-027_validate_operand_from_git_test.go @@ -141,9 +141,9 @@ var _ = Describe("GitOps Operator Sequential E2E Tests", func() { deploymentsShouldExist := []string{"argocd-redis", "argocd-server", "argocd-repo-server", "nginx-deployment"} for _, depl := range deploymentsShouldExist { depl := &appsv1.Deployment{ObjectMeta: metav1.ObjectMeta{Name: depl, Namespace: test_1_27_customNS.Name}} - Eventually(depl).Should(k8sFixture.ExistByName()) - Eventually(depl).Should(deploymentFixture.HaveReplicas(1)) - Eventually(depl).Should(deploymentFixture.HaveReadyReplicas(1)) + Eventually(depl, "4m", "5s").Should(k8sFixture.ExistByName()) + Eventually(depl, "4m", "5s").Should(deploymentFixture.HaveReplicas(1)) + Eventually(depl, "4m", "5s").Should(deploymentFixture.HaveReadyReplicas(1)) } statefulSet := &appsv1.StatefulSet{ObjectMeta: metav1.ObjectMeta{Name: "argocd-application-controller", Namespace: test_1_27_customNS.Name}} From b2d738e4a9fec3d1c31559cea21749d9bbb0f7d3 Mon Sep 17 00:00:00 2001 From: Jonathan West Date: Tue, 3 Feb 2026 13:36:02 -0500 Subject: [PATCH 3/3] chore: add debug hooks to additional tests Signed-off-by: Jonathan West --- ...lidate-ootb-manage-other-namespace_test.go | 26 +++++++--- ...date_handle_terminating_namespaces_test.go | 52 +++++++++++++------ 2 files changed, 53 insertions(+), 25 deletions(-) diff --git a/test/openshift/e2e/ginkgo/sequential/1-010_validate-ootb-manage-other-namespace_test.go b/test/openshift/e2e/ginkgo/sequential/1-010_validate-ootb-manage-other-namespace_test.go index 9ea7ea171..90f2fe58b 100644 --- a/test/openshift/e2e/ginkgo/sequential/1-010_validate-ootb-manage-other-namespace_test.go +++ b/test/openshift/e2e/ginkgo/sequential/1-010_validate-ootb-manage-other-namespace_test.go @@ -41,8 +41,11 @@ var _ = Describe("GitOps Operator Sequential E2E Tests", func() { Context("1-010_validate-ootb-manage-other-namespace", func() { var ( - ctx context.Context - k8sClient client.Client + ctx context.Context + k8sClient client.Client + nsTest_1_10_custom *corev1.Namespace + nsCleanupFunc func() + app *argocdv1alpha1.Application ) BeforeEach(func() { @@ -51,11 +54,21 @@ var _ = Describe("GitOps Operator Sequential E2E Tests", func() { ctx = context.Background() }) + AfterEach(func() { + fixture.OutputDebugOnFail(nsTest_1_10_custom, "openshift-gitops") + + if nsCleanupFunc != nil { + nsCleanupFunc() + } + if app != nil { + _ = k8sClient.Delete(ctx, app) + } + }) + It("verifies that openshift-gitops Argo CD instance is able to manage/unmanage other namespaces via managed-by label", func() { By("creating a new namespace that is managed by openshift-gitops Argo CD instance") - nsTest_1_10_custom, cleanupFunc1 := fixture.CreateManagedNamespaceWithCleanupFunc("test-1-10-custom", "openshift-gitops") - defer cleanupFunc1() + nsTest_1_10_custom, nsCleanupFunc = fixture.CreateManagedNamespaceWithCleanupFunc("test-1-10-custom", "openshift-gitops") openshiftgitopsArgoCD, err := argocdFixture.GetOpenShiftGitOpsNSArgoCD() Expect(err).ToNot(HaveOccurred()) @@ -91,7 +104,7 @@ var _ = Describe("GitOps Operator Sequential E2E Tests", func() { }})) By("creating a new Argo CD application in openshift-gitops ns, targeting the new namespace") - app := &argocdv1alpha1.Application{ + app = &argocdv1alpha1.Application{ ObjectMeta: metav1.ObjectMeta{Name: "test-1-10-custom", Namespace: openshiftgitopsArgoCD.Namespace}, Spec: argocdv1alpha1.ApplicationSpec{ Source: &argocdv1alpha1.ApplicationSource{ @@ -113,9 +126,6 @@ var _ = Describe("GitOps Operator Sequential E2E Tests", func() { }, } Expect(k8sClient.Create(ctx, app)).To(Succeed()) - defer func() { // cleanup on test exit - Expect(k8sClient.Delete(ctx, app)).To(Succeed()) - }() By("verifying that Argo CD is able to deploy to that other namespace") Eventually(app, "4m", "5s").Should(appFixture.HaveHealthStatusCode(health.HealthStatusHealthy)) diff --git a/test/openshift/e2e/ginkgo/sequential/1-102_validate_handle_terminating_namespaces_test.go b/test/openshift/e2e/ginkgo/sequential/1-102_validate_handle_terminating_namespaces_test.go index 556420ae1..9418ebff4 100644 --- a/test/openshift/e2e/ginkgo/sequential/1-102_validate_handle_terminating_namespaces_test.go +++ b/test/openshift/e2e/ginkgo/sequential/1-102_validate_handle_terminating_namespaces_test.go @@ -41,8 +41,15 @@ var _ = Describe("GitOps Operator Sequential E2E Tests", func() { Context("1-102_validate_handle_terminating_namespaces", func() { var ( - k8sClient client.Client - ctx context.Context + k8sClient client.Client + ctx context.Context + ns *corev1.Namespace + janeNs *corev1.Namespace + johnNs *corev1.Namespace + configMapJaneNs *corev1.ConfigMap + nsCleanupFunc func() + janeNsCleanupFunc func() + johnNsCleanupFunc func() ) BeforeEach(func() { @@ -52,11 +59,31 @@ var _ = Describe("GitOps Operator Sequential E2E Tests", func() { ctx = context.Background() }) + AfterEach(func() { + + fixture.OutputDebugOnFail(ns, janeNs, johnNs) + + // Remove the ConfigMap finalizer so the namespace can be cleaned up + if configMapJaneNs != nil { + configmapFixture.Update(configMapJaneNs, func(cm *corev1.ConfigMap) { + cm.Finalizers = nil + }) + } + if johnNsCleanupFunc != nil { + johnNsCleanupFunc() + } + if janeNsCleanupFunc != nil { + janeNsCleanupFunc() + } + if nsCleanupFunc != nil { + nsCleanupFunc() + } + }) + It("ensures that if one managed-by namespace is stuck in terminating, it does not prevent other managed-by namespaces from being managed or deployed to", func() { By("creating simple namespace-scoped Argo CD instance") - ns, cleanupFunc := fixture.CreateRandomE2ETestNamespaceWithCleanupFunc() - defer cleanupFunc() + ns, nsCleanupFunc = fixture.CreateRandomE2ETestNamespaceWithCleanupFunc() argoCD := &argov1beta1api.ArgoCD{ ObjectMeta: metav1.ObjectMeta{Name: "argocd", Namespace: ns.Name}, @@ -68,20 +95,12 @@ var _ = Describe("GitOps Operator Sequential E2E Tests", func() { Eventually(argoCD, "5m", "5s").Should(argocdFixture.BeAvailable()) By("creating a namespace 'jane' containing a ConfigMap with a unowned finalizer") - janeNs, cleanupFunc := fixture.CreateManagedNamespaceWithCleanupFunc("jane", ns.Name) - defer cleanupFunc() + janeNs, janeNsCleanupFunc = fixture.CreateManagedNamespaceWithCleanupFunc("jane", ns.Name) - configMapJaneNs := corev1.ConfigMap{ + configMapJaneNs = &corev1.ConfigMap{ ObjectMeta: metav1.ObjectMeta{Name: "my-config-map-2", Namespace: janeNs.Name, Finalizers: []string{"some.random/finalizer"}}, } - Expect(k8sClient.Create(ctx, &configMapJaneNs)).To(Succeed()) - - // At the end of the test, ensure the ConfigMap finalizer is removed so that the namespace is cleaned up - defer func() { - configmapFixture.Update(&configMapJaneNs, func(cm *corev1.ConfigMap) { - cm.Finalizers = nil - }) - }() + Expect(k8sClient.Create(ctx, configMapJaneNs)).To(Succeed()) By("deleting the jane NS in a background go routine, which puts the jane NS into a simulated stuck in terminating state") go func() { @@ -93,8 +112,7 @@ var _ = Describe("GitOps Operator Sequential E2E Tests", func() { Eventually(janeNs).Should(namespaceFixture.HavePhase(corev1.NamespaceTerminating)) By("creating John NS") - johnNs, cleanupFunc := fixture.CreateManagedNamespaceWithCleanupFunc("john", ns.Name) - defer cleanupFunc() + johnNs, johnNsCleanupFunc = fixture.CreateManagedNamespaceWithCleanupFunc("john", ns.Name) By("Wait for managed-by rolebindings to be created in John NS") Eventually(func() bool {