From 12c2deea7fa9ae6a897943428ab277fbc515a6c7 Mon Sep 17 00:00:00 2001 From: Anand Kumar Singh Date: Thu, 27 Aug 2026 18:24:44 +0530 Subject: [PATCH 01/18] fix: 1-006 test Signed-off-by: Anand Kumar Singh --- .../e2e/ginkgo/fixture/argocd/fixture.go | 14 +++ test/openshift/e2e/ginkgo/fixture/fixture.go | 2 +- .../1-006_validate_machine_config_test.go | 97 +++++++++++-------- 3 files changed, 72 insertions(+), 41 deletions(-) diff --git a/test/openshift/e2e/ginkgo/fixture/argocd/fixture.go b/test/openshift/e2e/ginkgo/fixture/argocd/fixture.go index 72c6fdbfccd..85b037aa871 100644 --- a/test/openshift/e2e/ginkgo/fixture/argocd/fixture.go +++ b/test/openshift/e2e/ginkgo/fixture/argocd/fixture.go @@ -44,6 +44,20 @@ func Update(obj *argov1beta1api.ArgoCD, modify func(*argov1beta1api.ArgoCD)) { time.Sleep(7 * time.Second) } +// CreateNewArgoCDInstance creates a new ArgoCD instance with an empty (zero) spec in the +// given namespace and returns it. Callers should wait for availability via BeAvailable. +func CreateNewArgoCDInstance(name, namespace string) *argov1beta1api.ArgoCD { + k8sClient, _ := utils.GetE2ETestKubeClient() + + argoCD := &argov1beta1api.ArgoCD{ + ObjectMeta: metav1.ObjectMeta{Name: name, Namespace: namespace}, + Spec: argov1beta1api.ArgoCDSpec{}, + } + Expect(k8sClient.Create(context.Background(), argoCD)).To(Succeed()) + + return argoCD +} + func GetOpenShiftGitOpsNSArgoCD() (*argov1beta1api.ArgoCD, error) { k8sClient, _ := utils.GetE2ETestKubeClient() diff --git a/test/openshift/e2e/ginkgo/fixture/fixture.go b/test/openshift/e2e/ginkgo/fixture/fixture.go index 8b3f8c85447..796c76a6017 100644 --- a/test/openshift/e2e/ginkgo/fixture/fixture.go +++ b/test/openshift/e2e/ginkgo/fixture/fixture.go @@ -670,7 +670,7 @@ func WaitForAllDeploymentsInTheNamespaceToBeReady(ns string, k8sClient client.Cl // All Deployments in NS are reconciled and ready return true - }, "3m", "1s").Should(BeTrue()) + }, "5m", "1s").Should(BeTrue()) // The above logic will successfully wait for Deployments to be ready. However, this does not mean that the operator's controller logic has completed it's initial cluster reconciliation logic (starting a watch then reconciling existing resources) // - I'm not aware of a way to detect when this has completed, so instead I am inserting a 15 second pause. diff --git a/test/openshift/e2e/ginkgo/sequential/1-006_validate_machine_config_test.go b/test/openshift/e2e/ginkgo/sequential/1-006_validate_machine_config_test.go index 1d16afddd8d..55e96e4a586 100644 --- a/test/openshift/e2e/ginkgo/sequential/1-006_validate_machine_config_test.go +++ b/test/openshift/e2e/ginkgo/sequential/1-006_validate_machine_config_test.go @@ -33,6 +33,7 @@ import ( argocdFixture "github.com/redhat-developer/gitops-operator/test/openshift/e2e/ginkgo/fixture/argocd" k8sFixture "github.com/redhat-developer/gitops-operator/test/openshift/e2e/ginkgo/fixture/k8s" appsv1 "k8s.io/api/apps/v1" + corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "sigs.k8s.io/controller-runtime/pkg/client" ) @@ -40,13 +41,14 @@ import ( var _ = Describe("GitOps Operator Sequential E2E Tests", func() { Context("1-006_validate_machine_config", func() { - // TODO: check if this test can use a new ArgoCD instance instead of the default openshift-gitops instance var ( - ctx context.Context - k8sClient client.Client - defaultArgoCD *argov1beta1api.ArgoCD - app *argocdv1alpha1.Application + ctx context.Context + k8sClient client.Client + ns *corev1.Namespace + cleanupFunc func() + argoCD *argov1beta1api.ArgoCD + app *argocdv1alpha1.Application ) BeforeEach(func() { @@ -57,43 +59,55 @@ var _ = Describe("GitOps Operator Sequential E2E Tests", func() { AfterEach(func() { - fixture.OutputDebugOnFail("openshift-gitops") - - if defaultArgoCD != nil { - - argocdFixture.Update(defaultArgoCD, func(ac *argov1beta1api.ArgoCD) { - ac.Spec.Repo.Replicas = nil - }) + if ns != nil { + fixture.OutputDebugOnFail(ns.Name) } - if app != nil { - Expect(k8sClient.Delete(ctx, app)).To(Succeed()) + // Restore the operator Subscription/Deployment to remove the cluster-config namespace we added + fixture.RestoreSubcriptionToDefault() + + if cleanupFunc != nil { + cleanupFunc() } }) It("verifies that repo server replicas can be modified via .spec.repo.replicas", Label("openshift"), func() { - By("setting the repo server replicas to 2 on openshift-gitops Argo CD") - var err error - defaultArgoCD, err = argocdFixture.GetOpenShiftGitOpsNSArgoCD() - Expect(err).ToNot(HaveOccurred()) - Expect(defaultArgoCD).ToNot(BeNil()) + // The Application in this test deploys a cluster-scoped resource (config.openshift.io/v1 Image), + // so the Argo CD instance must be cluster-scoped. That requires setting an env var on the operator, + // which is not possible when the operator runs locally. + if fixture.EnvLocalRun() { + Skip("Skipping test as LOCAL_RUN env var is set. In this case, it is not possible to set env var on gitops operator controller process.") + return + } + + By("creating a new namespace for the Argo CD instance") + ns, cleanupFunc = fixture.CreateRandomE2ETestNamespaceWithCleanupFunc() - argocdFixture.Update(defaultArgoCD, func(ac *argov1beta1api.ArgoCD) { - ac.Spec.Repo.Replicas = new(int32(2)) - }) + By("adding the new namespace to ARGOCD_CLUSTER_CONFIG_NAMESPACES so the instance is cluster-scoped") + fixture.SetEnvInOperatorSubscriptionOrDeployment("ARGOCD_CLUSTER_CONFIG_NAMESPACES", "openshift-gitops, "+ns.Name) + + By("creating a new Argo CD instance within the namespace") + argoCD = argocdFixture.CreateNewArgoCDInstance("argocd", ns.Name) + Eventually(argoCD, "8m", "5s").Should(argocdFixture.BeAvailable()) + +By("setting the repo server replicas to 2 on the Argo CD instance") + argocdFixture.Update(argoCD, func(ac *argov1beta1api.ArgoCD) { + replicas := int32(2) + ac.Spec.Repo.Replicas = &replicas + }) By("creating an Argo CD Application targeting the Argo CD namespace") app = &argocdv1alpha1.Application{ - ObjectMeta: metav1.ObjectMeta{Name: "validate-machine-config", Namespace: defaultArgoCD.Namespace}, + ObjectMeta: metav1.ObjectMeta{Name: "validate-machine-config", Namespace: ns.Name}, Spec: argocdv1alpha1.ApplicationSpec{ Source: &argocdv1alpha1.ApplicationSource{ - Path: "./test/examples/image", + Path: "./test/examples/nginx", RepoURL: "https://github.com/redhat-developer/gitops-operator", TargetRevision: "HEAD", }, Destination: argocdv1alpha1.ApplicationDestination{ - Namespace: defaultArgoCD.Namespace, + Namespace: ns.Name, Server: "https://kubernetes.default.svc", }, Project: "default", @@ -108,27 +122,26 @@ var _ = Describe("GitOps Operator Sequential E2E Tests", func() { Expect(k8sClient.Create(ctx, app)).To(Succeed()) By("waiting for Argo CD to become available after the repo server change we made") - Eventually(defaultArgoCD, "5m", "5s").Should(argocdFixture.BeAvailable()) + Eventually(argoCD, "5m", "5s").Should(argocdFixture.BeAvailable()) By("verifying deployment and statefulset have expected number of replicas, including the repo server which should have 2") deploymentsToVerify := []string{ - "openshift-gitops-server", - "openshift-gitops-redis", - "openshift-gitops-applicationset-controller", - "openshift-gitops-repo-server", + "argocd-server", + "argocd-redis", + "argocd-repo-server", } for _, deplToVerify := range deploymentsToVerify { depl := &appsv1.Deployment{ - ObjectMeta: metav1.ObjectMeta{Name: deplToVerify, Namespace: defaultArgoCD.Namespace}, + ObjectMeta: metav1.ObjectMeta{Name: deplToVerify, Namespace: ns.Name}, } Eventually(depl).Should(k8sFixture.ExistByName()) expectedReadyReplicas := 1 expectedReplicas := 1 - if deplToVerify == "openshift-gitops-repo-server" { + if deplToVerify == "argocd-repo-server" { expectedReadyReplicas = 2 expectedReplicas = 2 } @@ -138,8 +151,8 @@ var _ = Describe("GitOps Operator Sequential E2E Tests", func() { ss := &appsv1.StatefulSet{ ObjectMeta: metav1.ObjectMeta{ - Name: "openshift-gitops-application-controller", - Namespace: defaultArgoCD.Namespace, + Name: "argocd-application-controller", + Namespace: ns.Name, }, } Eventually(ss).Should(k8sFixture.ExistByName()) @@ -150,14 +163,18 @@ var _ = Describe("GitOps Operator Sequential E2E Tests", func() { Eventually(app, "4m", "5s").Should(application.HaveHealthStatusCode(health.HealthStatusHealthy)) Eventually(app, "4m", "5s").Should(application.HaveSyncStatusCode(argocdv1alpha1.SyncStatusCodeSynced)) - By("updating repo server replicas back to 1") - argocdFixture.Update(defaultArgoCD, func(ac *argov1beta1api.ArgoCD) { - ac.Spec.Repo.Replicas = new(int32(1)) - }) +By("updating repo server replicas back to 1") + argocdFixture.Update(argoCD, func(ac *argov1beta1api.ArgoCD) { + replicas := int32(1) + ac.Spec.Repo.Replicas = &replicas + }) + + By("waiting for Argo CD to become available after the repo server change we made") + Eventually(argoCD, "5m", "5s").Should(argocdFixture.BeAvailable()) - By("verifying repo server Deployment moves back to a single replica") + By("verifying repo server Deployment moves back to a single replica") repoServerDepl := &appsv1.Deployment{ - ObjectMeta: metav1.ObjectMeta{Name: "openshift-gitops-repo-server", Namespace: defaultArgoCD.Namespace}, + ObjectMeta: metav1.ObjectMeta{Name: "argocd-repo-server", Namespace: ns.Name}, } Eventually(repoServerDepl).Should(k8sFixture.ExistByName()) Eventually(repoServerDepl).Should(deployment.HaveReplicas(1)) From 1dbf74898d29068a8de5b0f29e5290444713bf7f Mon Sep 17 00:00:00 2001 From: Anand Kumar Singh Date: Thu, 27 Aug 2026 20:48:00 +0530 Subject: [PATCH 02/18] fix: 1-020 & partial 1-027 test Signed-off-by: Anand Kumar Singh --- test/openshift/e2e/ginkgo/fixture/fixture.go | 10 +++ .../1-006_validate_machine_config_test.go | 28 +++---- .../1-020_validate_redis_ha_nonha_test.go | 79 ++++++++++--------- .../1-027_validate_operand_from_git_test.go | 37 +++++---- 4 files changed, 84 insertions(+), 70 deletions(-) diff --git a/test/openshift/e2e/ginkgo/fixture/fixture.go b/test/openshift/e2e/ginkgo/fixture/fixture.go index 796c76a6017..176d62ea9a7 100644 --- a/test/openshift/e2e/ginkgo/fixture/fixture.go +++ b/test/openshift/e2e/ginkgo/fixture/fixture.go @@ -273,6 +273,16 @@ func CreateRandomE2ETestNamespaceWithCleanupFunc() (*corev1.Namespace, func()) { return ns, nsDeletionFunc(ns) } +// CreateNamespaceWithArgoCDInstance creates a random namespace, creates an ArgoCD instance with +// the given name in it, waits for it to be available, and returns the ArgoCD, namespace, and a +// cleanup func that deletes the namespace. +func CreateNamespaceWithArgoCDInstance(instanceName string) (*argov1beta1api.ArgoCD, *corev1.Namespace, func()) { + ns, cleanupFunc := CreateRandomE2ETestNamespaceWithCleanupFunc() + argoCDInstance := argocd.CreateNewArgoCDInstance(instanceName, ns.Name) + Eventually(argoCDInstance, "5m", "5s").Should(argocd.BeAvailable()) + return argoCDInstance, ns, cleanupFunc +} + // Create namespace for tests having a specific label for identification // - If the namespace already exists, it will be deleted first func CreateNamespace(name string) *corev1.Namespace { diff --git a/test/openshift/e2e/ginkgo/sequential/1-006_validate_machine_config_test.go b/test/openshift/e2e/ginkgo/sequential/1-006_validate_machine_config_test.go index 55e96e4a586..2085bec46c8 100644 --- a/test/openshift/e2e/ginkgo/sequential/1-006_validate_machine_config_test.go +++ b/test/openshift/e2e/ginkgo/sequential/1-006_validate_machine_config_test.go @@ -71,7 +71,7 @@ var _ = Describe("GitOps Operator Sequential E2E Tests", func() { } }) - It("verifies that repo server replicas can be modified via .spec.repo.replicas", Label("openshift"), func() { + It("verifies that repo server replicas can be modified via .spec.repo.replicas", Label("fixed"), func() { // The Application in this test deploys a cluster-scoped resource (config.openshift.io/v1 Image), // so the Argo CD instance must be cluster-scoped. That requires setting an env var on the operator, @@ -91,11 +91,11 @@ var _ = Describe("GitOps Operator Sequential E2E Tests", func() { argoCD = argocdFixture.CreateNewArgoCDInstance("argocd", ns.Name) Eventually(argoCD, "8m", "5s").Should(argocdFixture.BeAvailable()) -By("setting the repo server replicas to 2 on the Argo CD instance") - argocdFixture.Update(argoCD, func(ac *argov1beta1api.ArgoCD) { - replicas := int32(2) - ac.Spec.Repo.Replicas = &replicas - }) + By("setting the repo server replicas to 2 on the Argo CD instance") + argocdFixture.Update(argoCD, func(ac *argov1beta1api.ArgoCD) { + replicas := int32(2) + ac.Spec.Repo.Replicas = &replicas + }) By("creating an Argo CD Application targeting the Argo CD namespace") app = &argocdv1alpha1.Application{ @@ -163,16 +163,16 @@ By("setting the repo server replicas to 2 on the Argo CD instance") Eventually(app, "4m", "5s").Should(application.HaveHealthStatusCode(health.HealthStatusHealthy)) Eventually(app, "4m", "5s").Should(application.HaveSyncStatusCode(argocdv1alpha1.SyncStatusCodeSynced)) -By("updating repo server replicas back to 1") - argocdFixture.Update(argoCD, func(ac *argov1beta1api.ArgoCD) { - replicas := int32(1) - ac.Spec.Repo.Replicas = &replicas - }) + By("updating repo server replicas back to 1") + argocdFixture.Update(argoCD, func(ac *argov1beta1api.ArgoCD) { + replicas := int32(1) + ac.Spec.Repo.Replicas = &replicas + }) - By("waiting for Argo CD to become available after the repo server change we made") - Eventually(argoCD, "5m", "5s").Should(argocdFixture.BeAvailable()) + By("waiting for Argo CD to become available after the repo server change we made") + Eventually(argoCD, "5m", "5s").Should(argocdFixture.BeAvailable()) - By("verifying repo server Deployment moves back to a single replica") + By("verifying repo server Deployment moves back to a single replica") repoServerDepl := &appsv1.Deployment{ ObjectMeta: metav1.ObjectMeta{Name: "argocd-repo-server", Namespace: ns.Name}, } diff --git a/test/openshift/e2e/ginkgo/sequential/1-020_validate_redis_ha_nonha_test.go b/test/openshift/e2e/ginkgo/sequential/1-020_validate_redis_ha_nonha_test.go index c78ff47d4bb..a4d012ffc7b 100644 --- a/test/openshift/e2e/ginkgo/sequential/1-020_validate_redis_ha_nonha_test.go +++ b/test/openshift/e2e/ginkgo/sequential/1-020_validate_redis_ha_nonha_test.go @@ -36,55 +36,56 @@ import ( var _ = Describe("GitOps Operator Sequential E2E Tests", func() { Context("1-020_validate_redis_ha_nonha", func() { - // TODO: check if this test can use a new ArgoCD instance instead of the default openshift-gitops instance BeforeEach(func() { fixture.EnsureSequentialCleanSlate() }) - It("validates Redis HA and Non-HA", Label("openshift"), func() { + It("validates Redis HA and Non-HA", Label("fixed"), func() { // This test enables HA, so it needs to be running on a cluster with at least 3 nodes node.ExpectHasAtLeastXNodes(3) - By("ensuring the openshift-gitops Argo CD instance is running") - gitopsArgoCD, err := argocdFixture.GetOpenShiftGitOpsNSArgoCD() - Expect(err).ToNot(HaveOccurred()) - Eventually(gitopsArgoCD, "5m", "5s").Should(argocdFixture.BeAvailable()) - Eventually(gitopsArgoCD).Should(argocdFixture.HaveRedisStatus("Running")) + ns, cleanupFunc := fixture.CreateRandomE2ETestNamespaceWithCleanupFunc() + defer cleanupFunc() + + By("creating a new Argo CD instance and waiting for it to be ready") + argoCD := argocdFixture.CreateNewArgoCDInstance("argocd-020", ns.Name) + Eventually(argoCD, "5m", "5s").Should(argocdFixture.BeAvailable()) + Eventually(argoCD).Should(argocdFixture.HaveRedisStatus("Running")) By("verifying various expected resources exist in namespace") - Eventually(&corev1.Service{ObjectMeta: metav1.ObjectMeta{Name: "openshift-gitops-redis", Namespace: "openshift-gitops"}}).Should(k8sFixture.ExistByName()) + Eventually(&corev1.Service{ObjectMeta: metav1.ObjectMeta{Name: "argocd-020-redis", Namespace: ns.Name}}).Should(k8sFixture.ExistByName()) - depl := &appsv1.Deployment{ObjectMeta: metav1.ObjectMeta{Name: "openshift-gitops-redis", Namespace: "openshift-gitops"}} + depl := &appsv1.Deployment{ObjectMeta: metav1.ObjectMeta{Name: "argocd-020-redis", Namespace: ns.Name}} Eventually(depl).Should(k8sFixture.ExistByName()) Eventually(depl).Should(deploymentFixture.HaveReadyReplicas(1)) By("verifies Redis HA resources should not exist since we are in non-HA mode") - Consistently(&corev1.Service{ObjectMeta: metav1.ObjectMeta{Name: "openshift-gitops-redis-ha", Namespace: "openshift-gitops"}}).Should(k8sFixture.NotExistByName()) + Consistently(&corev1.Service{ObjectMeta: metav1.ObjectMeta{Name: "argocd-020-redis-ha", Namespace: ns.Name}}).Should(k8sFixture.NotExistByName()) - Consistently(&corev1.Service{ObjectMeta: metav1.ObjectMeta{Name: "openshift-gitops-redis-ha-haproxy", Namespace: "openshift-gitops"}}).Should(k8sFixture.NotExistByName()) + Consistently(&corev1.Service{ObjectMeta: metav1.ObjectMeta{Name: "argocd-020-redis-ha-haproxy", Namespace: ns.Name}}).Should(k8sFixture.NotExistByName()) - Consistently(&appsv1.Deployment{ObjectMeta: metav1.ObjectMeta{Name: "openshift-gitops-redis-ha-haproxy", Namespace: "openshift-gitops"}}).Should(k8sFixture.NotExistByName()) + Consistently(&appsv1.Deployment{ObjectMeta: metav1.ObjectMeta{Name: "argocd-020-redis-ha-haproxy", Namespace: ns.Name}}).Should(k8sFixture.NotExistByName()) - Consistently(&appsv1.StatefulSet{ObjectMeta: metav1.ObjectMeta{Name: "openshift-gitops-redis-ha-server", Namespace: "openshift-gitops"}}).Should(k8sFixture.NotExistByName()) + Consistently(&appsv1.StatefulSet{ObjectMeta: metav1.ObjectMeta{Name: "argocd-020-redis-ha-server", Namespace: ns.Name}}).Should(k8sFixture.NotExistByName()) - By("enabling HA on openshift-gitops Argo CD instance") - argocdFixture.Update(gitopsArgoCD, func(argocd *v1beta1.ArgoCD) { - argocd.Spec.HA.Enabled = true + By("enabling HA on Argo CD instance") + argocdFixture.Update(argoCD, func(ac *v1beta1.ArgoCD) { + ac.Spec.HA.Enabled = true }) By("verifying expected HA resources are eventually created after we enabled HA") - Eventually(&corev1.Service{ObjectMeta: metav1.ObjectMeta{Name: "openshift-gitops-redis-ha", Namespace: "openshift-gitops"}}).Should(k8sFixture.ExistByName()) + Eventually(&corev1.Service{ObjectMeta: metav1.ObjectMeta{Name: "argocd-020-redis-ha", Namespace: ns.Name}}).Should(k8sFixture.ExistByName()) - Eventually(&corev1.Service{ObjectMeta: metav1.ObjectMeta{Name: "openshift-gitops-redis-ha-haproxy", Namespace: "openshift-gitops"}}).Should(k8sFixture.ExistByName()) + Eventually(&corev1.Service{ObjectMeta: metav1.ObjectMeta{Name: "argocd-020-redis-ha-haproxy", Namespace: ns.Name}}).Should(k8sFixture.ExistByName()) - Eventually(gitopsArgoCD, "4m", "5s").Should(argocdFixture.HavePhase("Available")) - Eventually(gitopsArgoCD).Should(argocdFixture.HaveRedisStatus("Running")) + Eventually(argoCD, "4m", "5s").Should(argocdFixture.HavePhase("Available")) + Eventually(argoCD).Should(argocdFixture.HaveRedisStatus("Running")) - statefulSet := &appsv1.StatefulSet{ObjectMeta: metav1.ObjectMeta{Name: "openshift-gitops-redis-ha-server", Namespace: "openshift-gitops"}} + statefulSet := &appsv1.StatefulSet{ObjectMeta: metav1.ObjectMeta{Name: "argocd-020-redis-ha-server", Namespace: ns.Name}} Eventually(statefulSet).Should(statefulsetFixture.HaveReadyReplicas(3)) Expect(statefulSet.Spec.Template.Spec.Affinity).To(Equal( &corev1.Affinity{ @@ -93,7 +94,7 @@ var _ = Describe("GitOps Operator Sequential E2E Tests", func() { { LabelSelector: &metav1.LabelSelector{ MatchLabels: map[string]string{ - "app.kubernetes.io/name": "openshift-gitops-redis-ha", + "app.kubernetes.io/name": "argocd-020-redis-ha", }, }, TopologyKey: "kubernetes.io/hostname", @@ -102,19 +103,19 @@ var _ = Describe("GitOps Operator Sequential E2E Tests", func() { }, })) - Eventually(&appsv1.Deployment{ObjectMeta: metav1.ObjectMeta{Name: "openshift-gitops-redis-ha-haproxy", Namespace: "openshift-gitops"}}, "60s", "5s").Should(deploymentFixture.HaveReadyReplicas(3)) + Eventually(&appsv1.Deployment{ObjectMeta: metav1.ObjectMeta{Name: "argocd-020-redis-ha-haproxy", Namespace: ns.Name}}, "60s", "5s").Should(deploymentFixture.HaveReadyReplicas(3)) By("verifying non-HA resources no longer exist, since HA is enabled") - Expect(&corev1.Service{ObjectMeta: metav1.ObjectMeta{Name: "openshift-gitops-redis", Namespace: "openshift-gitops"}}).To(k8sFixture.NotExistByName()) + Expect(&corev1.Service{ObjectMeta: metav1.ObjectMeta{Name: "argocd-020-redis", Namespace: ns.Name}}).To(k8sFixture.NotExistByName()) - Expect(&appsv1.Deployment{ObjectMeta: metav1.ObjectMeta{Name: "openshift-gitops-redis", Namespace: "openshift-gitops"}}).To(k8sFixture.NotExistByName()) + Expect(&appsv1.Deployment{ObjectMeta: metav1.ObjectMeta{Name: "argocd-020-redis", Namespace: ns.Name}}).To(k8sFixture.NotExistByName()) By("updating ArgoCD CR to add cpu and memory resource request and limits to HA workloads") - argocdFixture.Update(gitopsArgoCD, func(argocd *v1beta1.ArgoCD) { - argocd.Spec.HA.Enabled = true - argocd.Spec.HA.Resources = &corev1.ResourceRequirements{ + argocdFixture.Update(argoCD, func(ac *v1beta1.ArgoCD) { + ac.Spec.HA.Enabled = true + ac.Spec.HA.Resources = &corev1.ResourceRequirements{ Limits: corev1.ResourceList{ corev1.ResourceCPU: resource.MustParse("500m"), corev1.ResourceMemory: resource.MustParse("256Mi"), @@ -127,12 +128,12 @@ var _ = Describe("GitOps Operator Sequential E2E Tests", func() { }) By("Argo CD should eventually be ready after updating the resource requirements") - Eventually(gitopsArgoCD, "5m", "5s").Should(argocdFixture.BeAvailable()) // it can take a while to schedule the Pods - Eventually(gitopsArgoCD, "5m", "5s").Should(argocdFixture.HaveRedisStatus("Running")) + Eventually(argoCD, "5m", "5s").Should(argocdFixture.BeAvailable()) // it can take a while to schedule the Pods + Eventually(argoCD, "5m", "5s").Should(argocdFixture.HaveRedisStatus("Running")) By("verifying Deployment and StatefulSet have expected resources that we set in previous step") - depl = &appsv1.Deployment{ObjectMeta: metav1.ObjectMeta{Name: "openshift-gitops-redis-ha-haproxy", Namespace: "openshift-gitops"}} + depl = &appsv1.Deployment{ObjectMeta: metav1.ObjectMeta{Name: "argocd-020-redis-ha-haproxy", Namespace: ns.Name}} Eventually(depl, "2m", "5s").Should(deploymentFixture.HaveReadyReplicas(3)) haProxyContainer := deploymentFixture.GetTemplateSpecContainerByName("haproxy", *depl) @@ -150,7 +151,7 @@ var _ = Describe("GitOps Operator Sequential E2E Tests", func() { Expect(configInitContainer.Resources.Requests.Cpu().AsDec().String()).To(Equal("0.200")) Expect(configInitContainer.Resources.Requests.Memory().AsDec().String()).To(Equal("134217728")) - ss := &appsv1.StatefulSet{ObjectMeta: metav1.ObjectMeta{Name: "openshift-gitops-redis-ha-server", Namespace: "openshift-gitops"}} + ss := &appsv1.StatefulSet{ObjectMeta: metav1.ObjectMeta{Name: "argocd-020-redis-ha-server", Namespace: ns.Name}} Eventually(ss, "2m", "5s").Should(statefulsetFixture.HaveReadyReplicas(3)) redisContainer := statefulsetFixture.GetTemplateSpecContainerByName("redis", *ss) @@ -175,23 +176,23 @@ var _ = Describe("GitOps Operator Sequential E2E Tests", func() { By("disabling HA on ArgoCD CR") - argocdFixture.Update(gitopsArgoCD, func(argocd *v1beta1.ArgoCD) { - argocd.Spec.HA.Enabled = false + argocdFixture.Update(argoCD, func(ac *v1beta1.ArgoCD) { + ac.Spec.HA.Enabled = false }) By("verifying Argo CD becomes ready again after HA is disabled") - Eventually(gitopsArgoCD, "5m", "5s").Should(argocdFixture.BeAvailable()) - Eventually(gitopsArgoCD, "60s", "5s").Should(argocdFixture.HaveRedisStatus("Running")) + Eventually(argoCD, "5m", "5s").Should(argocdFixture.BeAvailable()) + Eventually(argoCD, "60s", "5s").Should(argocdFixture.HaveRedisStatus("Running")) By("verifying expected non-HA resources exist again and HA resources no longer exist") - depl = &appsv1.Deployment{ObjectMeta: metav1.ObjectMeta{Name: "openshift-gitops-redis", Namespace: "openshift-gitops"}} + depl = &appsv1.Deployment{ObjectMeta: metav1.ObjectMeta{Name: "argocd-020-redis", Namespace: ns.Name}} Eventually(depl).Should(k8sFixture.ExistByName()) Eventually(depl).Should(deploymentFixture.HaveReadyReplicas(1)) - Consistently(&appsv1.Deployment{ObjectMeta: metav1.ObjectMeta{Name: "openshift-gitops-redis-ha-haproxy", Namespace: "openshift-gitops"}}).Should(k8sFixture.NotExistByName()) + Consistently(&appsv1.Deployment{ObjectMeta: metav1.ObjectMeta{Name: "argocd-020-redis-ha-haproxy", Namespace: ns.Name}}).Should(k8sFixture.NotExistByName()) - Consistently(&appsv1.StatefulSet{ObjectMeta: metav1.ObjectMeta{Name: "openshift-gitops-redis-ha-server", Namespace: "openshift-gitops"}}).Should(k8sFixture.NotExistByName()) + Consistently(&appsv1.StatefulSet{ObjectMeta: metav1.ObjectMeta{Name: "argocd-020-redis-ha-server", Namespace: ns.Name}}).Should(k8sFixture.NotExistByName()) }) }) 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 171ec8a1864..7d58344cada 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 @@ -20,6 +20,7 @@ import ( "context" "github.com/argoproj-labs/argocd-operator/api/v1beta1" + argov1beta1api "github.com/argoproj-labs/argocd-operator/api/v1beta1" "github.com/argoproj/argo-cd/gitops-engine/pkg/health" argocdv1alpha1 "github.com/argoproj/argo-cd/v3/pkg/apis/application/v1alpha1" . "github.com/onsi/ginkgo/v2" @@ -42,13 +43,13 @@ import ( var _ = Describe("GitOps Operator Sequential E2E Tests", func() { Context("1-027_validate_operand_from_git", func() { - // TODO: check if this test can use a new ArgoCD instance instead of the default openshift-gitops instance var ( ctx context.Context k8sClient client.Client app *argocdv1alpha1.Application test_1_27_custom *corev1.Namespace + parentNS *corev1.Namespace ) BeforeEach(func() { @@ -59,36 +60,38 @@ var _ = Describe("GitOps Operator Sequential E2E Tests", func() { AfterEach(func() { - fixture.OutputDebugOnFail(test_1_27_custom, "openshift-gitops") + fixture.OutputDebugOnFail(test_1_27_custom, parentNS) - if app != nil { - Expect(k8sClient.Delete(ctx, app)).To(Succeed()) - } + // if app != nil { + // Expect(k8sClient.Delete(ctx, app)).To(Succeed()) + // } if test_1_27_custom != nil { Expect(k8sClient.Delete(ctx, test_1_27_custom)).To(Succeed()) } }) - It("verifies that a custom Argo CD instance can be deployed by the 'openshift-gitops' Argo CD instance. It also verfies that the custom Argo CD instance is able to deploy a simple application", Label("openshift"), func() { - - openshiftgitopsArgoCD, err := argocdFixture.GetOpenShiftGitOpsNSArgoCD() - Expect(err).ToNot(HaveOccurred()) + It("verifies that a custom Argo CD instance can be deployed by an Argo CD instance via GitOps, and the deployed instance is able to deploy a simple application", Label("openshift"), func() { - By("verifying openshift-gitops Argo CD instance is available") - Eventually(openshiftgitopsArgoCD, "5m", "5s").Should(argocdFixture.BeAvailable()) + parentNS, cleanupFunc := fixture.CreateNamespaceWithCleanupFunc("argocd-027") + defer cleanupFunc() + parentArgoCD := &argov1beta1api.ArgoCD{ + ObjectMeta: metav1.ObjectMeta{Name: "argocd-027", Namespace: parentNS.Name}, + } + Expect(k8sClient.Create(ctx, parentArgoCD)).To(Succeed()) + Eventually(parentArgoCD, "5m", "5s").Should(argocdFixture.BeAvailable()) - By("creating Argo CD Application in openshift-gitops namespace") + By("creating Argo CD Application in parent namespace") app = &argocdv1alpha1.Application{ - ObjectMeta: metav1.ObjectMeta{Name: "1-27-argocd", Namespace: openshiftgitopsArgoCD.Namespace}, + ObjectMeta: metav1.ObjectMeta{Name: "1-27-argocd", Namespace: parentArgoCD.Namespace}, Spec: argocdv1alpha1.ApplicationSpec{ Source: &argocdv1alpha1.ApplicationSource{ - Path: "./operator-acceptance/1-027_operand-from-git", + Path: ".test/examples/operator-acceptance/1-027_operand-from-git", // TODO: Move this repository to a better location - RepoURL: "https://github.com/jannfis/operator-e2e-git", + RepoURL: "https://github.com/redhat-developer/gitops-operator", TargetRevision: "HEAD", }, Destination: argocdv1alpha1.ApplicationDestination{ - Namespace: openshiftgitopsArgoCD.Namespace, + Namespace: parentNS.Name, Server: "https://kubernetes.default.svc", }, Project: "default", @@ -108,7 +111,7 @@ var _ = Describe("GitOps Operator Sequential E2E Tests", func() { } Eventually(test_1_27_custom, "5m", "5s").Should(k8sFixture.ExistByName()) - Eventually(test_1_27_custom).Should(namespaceFixture.HaveLabel("argocd.argoproj.io/managed-by", "openshift-gitops")) + Eventually(test_1_27_custom).Should(namespaceFixture.HaveLabel("argocd.argoproj.io/managed-by", parentNS.Name)) Eventually(app, "4m", "5s").Should(appFixture.HaveHealthStatusCode(health.HealthStatusHealthy)) Eventually(app, "4m", "5s").Should(appFixture.HaveSyncStatusCode(argocdv1alpha1.SyncStatusCodeSynced)) From 4101fc20fd2d128eeb615fb5900a23ce84ab928d Mon Sep 17 00:00:00 2001 From: Anand Kumar Singh Date: Fri, 28 Aug 2026 16:48:43 +0530 Subject: [PATCH 03/18] fix: 1-027 partial Signed-off-by: Anand Kumar Singh --- test/examples/operator-acceptance/argocd.yaml | 2 +- .../1-027_validate_operand_from_git_test.go | 38 +++++++++---------- 2 files changed, 20 insertions(+), 20 deletions(-) diff --git a/test/examples/operator-acceptance/argocd.yaml b/test/examples/operator-acceptance/argocd.yaml index eea6bcecb9c..08beeec1819 100644 --- a/test/examples/operator-acceptance/argocd.yaml +++ b/test/examples/operator-acceptance/argocd.yaml @@ -1,4 +1,4 @@ -apiVersion: argoproj.io/v1alpha1 +apiVersion: argoproj.io/v1beta1 kind: ArgoCD metadata: name: argocd 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 7d58344cada..a630dce4ca6 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 @@ -20,7 +20,6 @@ import ( "context" "github.com/argoproj-labs/argocd-operator/api/v1beta1" - argov1beta1api "github.com/argoproj-labs/argocd-operator/api/v1beta1" "github.com/argoproj/argo-cd/gitops-engine/pkg/health" argocdv1alpha1 "github.com/argoproj/argo-cd/v3/pkg/apis/application/v1alpha1" . "github.com/onsi/ginkgo/v2" @@ -60,38 +59,39 @@ var _ = Describe("GitOps Operator Sequential E2E Tests", func() { AfterEach(func() { - fixture.OutputDebugOnFail(test_1_27_custom, parentNS) + fixture.OutputDebugOnFail(test_1_27_custom, "argocd-027") - // if app != nil { - // Expect(k8sClient.Delete(ctx, app)).To(Succeed()) - // } if test_1_27_custom != nil { Expect(k8sClient.Delete(ctx, test_1_27_custom)).To(Succeed()) } }) - It("verifies that a custom Argo CD instance can be deployed by an Argo CD instance via GitOps, and the deployed instance is able to deploy a simple application", Label("openshift"), func() { + It("verifies that a custom Argo CD instance can be deployed by the 'argocd-027' Argo CD instance. It also verfies that the custom Argo CD instance is able to deploy a simple application", Label("openshift"), func() { - parentNS, cleanupFunc := fixture.CreateNamespaceWithCleanupFunc("argocd-027") - defer cleanupFunc() - parentArgoCD := &argov1beta1api.ArgoCD{ - ObjectMeta: metav1.ObjectMeta{Name: "argocd-027", Namespace: parentNS.Name}, + By("getting creating Argo CD instance in new namespace") + _, cleanup := fixture.CreateNamespaceWithCleanupFunc("argocd-027") + defer cleanup() + ArgoCD := &v1beta1.ArgoCD{ + ObjectMeta: metav1.ObjectMeta{Name: "argocd-027", Namespace: "argocd-027"}, } - Expect(k8sClient.Create(ctx, parentArgoCD)).To(Succeed()) - Eventually(parentArgoCD, "5m", "5s").Should(argocdFixture.BeAvailable()) + Expect(k8sClient.Create(ctx, ArgoCD)).To(Succeed()) - By("creating Argo CD Application in parent namespace") + fixture.SetEnvInOperatorSubscriptionOrDeployment("ARGOCD_CLUSTER_CONFIG_NAMESPACES", "argocd-027") + + By("verifying argocd-027 Argo CD instance is available") + Eventually(ArgoCD, "5m", "5s").Should(argocdFixture.BeAvailable()) + + By("creating Argo CD Application in argocd-027 namespace") app = &argocdv1alpha1.Application{ - ObjectMeta: metav1.ObjectMeta{Name: "1-27-argocd", Namespace: parentArgoCD.Namespace}, + ObjectMeta: metav1.ObjectMeta{Name: "argocd-027", Namespace: ArgoCD.Namespace}, Spec: argocdv1alpha1.ApplicationSpec{ Source: &argocdv1alpha1.ApplicationSource{ - Path: ".test/examples/operator-acceptance/1-027_operand-from-git", - // TODO: Move this repository to a better location + Path: "./test/examples/operator-acceptance", RepoURL: "https://github.com/redhat-developer/gitops-operator", TargetRevision: "HEAD", }, Destination: argocdv1alpha1.ApplicationDestination{ - Namespace: parentNS.Name, + Namespace: ArgoCD.Namespace, Server: "https://kubernetes.default.svc", }, Project: "default", @@ -105,13 +105,13 @@ var _ = Describe("GitOps Operator Sequential E2E Tests", func() { } Expect(k8sClient.Create(ctx, app)).To(Succeed()) - By("verifying test-1-27-custom NS is created and is managed by openshift-gitops, and Application deploys successfully") + By("verifying test-1-27-custom NS is created and is managed by argocd-027, and Application deploys successfully") test_1_27_custom = &corev1.Namespace{ ObjectMeta: metav1.ObjectMeta{Name: "test-1-27-custom"}, } Eventually(test_1_27_custom, "5m", "5s").Should(k8sFixture.ExistByName()) - Eventually(test_1_27_custom).Should(namespaceFixture.HaveLabel("argocd.argoproj.io/managed-by", parentNS.Name)) + Eventually(test_1_27_custom).Should(namespaceFixture.HaveLabel("argocd.argoproj.io/managed-by", "argocd-027")) Eventually(app, "4m", "5s").Should(appFixture.HaveHealthStatusCode(health.HealthStatusHealthy)) Eventually(app, "4m", "5s").Should(appFixture.HaveSyncStatusCode(argocdv1alpha1.SyncStatusCodeSynced)) From 0db97c5263886365ba71a79b03bba16b3b994e70 Mon Sep 17 00:00:00 2001 From: Anand Kumar Singh Date: Fri, 28 Aug 2026 17:23:27 +0530 Subject: [PATCH 04/18] fix: 1-035, add portforwarding intead of route Signed-off-by: Anand Kumar Singh --- .../e2e/ginkgo/fixture/argocd/fixture.go | 87 +++++++++++++++++++ .../1-028-validate_run_on_infra_test.go | 2 - ..._validate_argocd_secret_repopulate_test.go | 18 ++-- 3 files changed, 100 insertions(+), 7 deletions(-) diff --git a/test/openshift/e2e/ginkgo/fixture/argocd/fixture.go b/test/openshift/e2e/ginkgo/fixture/argocd/fixture.go index 85b037aa871..712b623e807 100644 --- a/test/openshift/e2e/ginkgo/fixture/argocd/fixture.go +++ b/test/openshift/e2e/ginkgo/fixture/argocd/fixture.go @@ -1,8 +1,10 @@ package argocd import ( + "bufio" "context" "fmt" + "io" "os/exec" "strings" "time" @@ -313,6 +315,91 @@ func LogInToDefaultArgoCDInstance() error { } +// LogInToArgoCDInstanceWithoutRoute logs in to an ArgoCD instance via kubectl +// port-forward instead of an OpenShift Route, so it works on xks clusters. +// instanceName is the ArgoCD CR name (e.g. "openshift-gitops"); namespace is its namespace. +// The returned cancel func stops the port-forward; call it (or defer it) after all argocd +// CLI calls in the test are done, since the CLI stores localhost:18080 as the server address. +func LogInToArgoCDInstanceWithoutRoute(instanceName, namespace string) (func(), error) { + k8sClient, _, err := utils.GetE2ETestKubeClientWithError() + if err != nil { + return nil, err + } + + secretName := instanceName + "-cluster" + secret := &corev1.Secret{ObjectMeta: metav1.ObjectMeta{Name: secretName, Namespace: namespace}} + if err := k8sClient.Get(context.Background(), client.ObjectKeyFromObject(secret), secret); err != nil { + return nil, fmt.Errorf("unable to locate %q Secret", secretName) + } + + const localPort = "18080" + cancel := portForwardArgoCD(namespace, "svc/"+instanceName+"-server", localPort+":80") + + output, err := RunArgoCDCLI("login", "localhost:"+localPort, "--username", "admin", + "--password", string(secret.Data["admin.password"]), "--insecure") + if err != nil { + cancel() + return nil, err + } + + if !strings.Contains(output, "'admin:login' logged in successfully") { + cancel() + return nil, fmt.Errorf("unable to log in to ArgoCD instance %q in namespace %q", instanceName, namespace) + } + + return cancel, nil +} + +// portForwardArgoCD starts kubectl port-forward and returns a cancel func. +// Blocks until the tunnel is ready (or Fail()s after 60s). +func portForwardArgoCD(namespace, subject, port string) func() { + cmd := exec.Command("kubectl", "port-forward", "-n", namespace, subject, port) // #nosec G204 + + stdout, err := cmd.StdoutPipe() + Expect(err).ToNot(HaveOccurred()) + stderr, err := cmd.StderrPipe() + Expect(err).ToNot(HaveOccurred()) + + ready := make(chan struct{}) + + stream := func(r io.Reader, signal func()) { + defer GinkgoRecover() + sc := bufio.NewScanner(r) + for sc.Scan() { + line := sc.Text() + GinkgoWriter.Println("port-forward:", line) + if signal != nil && strings.HasPrefix(line, "Forwarding from") { + signal() + signal = nil + } + } + } + + Expect(cmd.Start()).To(Succeed()) + go stream(stdout, func() { close(ready) }) + go stream(stderr, nil) + go func() { + defer GinkgoRecover() + if waitErr := cmd.Wait(); waitErr != nil && + !strings.Contains(waitErr.Error(), "killed") && + !strings.Contains(waitErr.Error(), "signal: killed") { + GinkgoWriter.Println("port-forward exited:", waitErr) + } + }() + + select { + case <-ready: + case <-time.After(60 * time.Second): + Fail("timed out waiting for port-forward to be ready") + } + + return func() { + if cmd.Process != nil { + _ = cmd.Process.Kill() + } + } +} + func RunArgoCDCLI(args ...string) (string, error) { cmdArgs := append([]string{"argocd"}, args...) diff --git a/test/openshift/e2e/ginkgo/sequential/1-028-validate_run_on_infra_test.go b/test/openshift/e2e/ginkgo/sequential/1-028-validate_run_on_infra_test.go index 0ac49a839dc..671ab91eab8 100644 --- a/test/openshift/e2e/ginkgo/sequential/1-028-validate_run_on_infra_test.go +++ b/test/openshift/e2e/ginkgo/sequential/1-028-validate_run_on_infra_test.go @@ -25,8 +25,6 @@ import ( var _ = Describe("GitOps Operator Sequential E2E Tests", func() { Context("1-028-validate_run_on_infra_test", func() { - // TODO: check if this test can use a new ArgoCD instance instead of the default openshift-gitops instance - var ( ctx context.Context k8sClient client.Client diff --git a/test/openshift/e2e/ginkgo/sequential/1-035_validate_argocd_secret_repopulate_test.go b/test/openshift/e2e/ginkgo/sequential/1-035_validate_argocd_secret_repopulate_test.go index 3146cad692b..0df0d88c1ef 100644 --- a/test/openshift/e2e/ginkgo/sequential/1-035_validate_argocd_secret_repopulate_test.go +++ b/test/openshift/e2e/ginkgo/sequential/1-035_validate_argocd_secret_repopulate_test.go @@ -3,6 +3,7 @@ package sequential import ( "context" + "github.com/argoproj-labs/argocd-operator/api/v1beta1" . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" "github.com/redhat-developer/gitops-operator/test/openshift/e2e/ginkgo/fixture" @@ -36,13 +37,18 @@ var _ = Describe("GitOps Operator Sequential E2E Tests", func() { It("verifies 'argocd-secret' secret is regenerated and we are able to login using that Secret", Label("openshift"), func() { - By("checking OpenShift GitOps ArgoCD instance is available") - argocd, err := argocdFixture.GetOpenShiftGitOpsNSArgoCD() - Expect(err).ToNot(HaveOccurred()) + By("creating and checking ArgoCD instance is available") + namespace, cleanup := fixture.CreateRandomE2ETestNamespaceWithCleanupFunc() + defer cleanup() + argocd := &v1beta1.ArgoCD{ + ObjectMeta: metav1.ObjectMeta{Name: "argocd", Namespace: namespace.Name}, + } + Expect(k8sClient.Create(ctx, argocd)).To(Succeed()) + Eventually(argocd, "5m", "5s").Should(argocdFixture.BeAvailable()) By("removing data from argocd-secret, to check that it is regenerated") - secret := &corev1.Secret{ObjectMeta: metav1.ObjectMeta{Name: "argocd-secret", Namespace: "openshift-gitops"}} + secret := &corev1.Secret{ObjectMeta: metav1.ObjectMeta{Name: "argocd-secret", Namespace: namespace.Name}} secretFixture.Update(secret, func(s *corev1.Secret) { s.Data = nil }) @@ -78,7 +84,9 @@ var _ = Describe("GitOps Operator Sequential E2E Tests", func() { Eventually(depl, "1m", "5s").Should(deploymentFixture.HaveReadyReplicas(1)) } - Expect(argocdFixture.LogInToDefaultArgoCDInstance()).To(Succeed()) + cancel, err := argocdFixture.LogInToArgoCDInstanceWithoutRoute(argocd.Name, namespace.Name) + Expect(err).ToNot(HaveOccurred()) + defer cancel() }) }) }) From 8115beea66c971d9594c925fdfc43cd4c61388ec Mon Sep 17 00:00:00 2001 From: Anand Kumar Singh Date: Fri, 28 Aug 2026 17:32:34 +0530 Subject: [PATCH 05/18] chore: deadcode Signed-off-by: Anand Kumar Singh --- .../ginkgo/sequential/1-027_validate_operand_from_git_test.go | 1 - 1 file changed, 1 deletion(-) 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 a630dce4ca6..0a92738a23c 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 @@ -48,7 +48,6 @@ var _ = Describe("GitOps Operator Sequential E2E Tests", func() { k8sClient client.Client app *argocdv1alpha1.Application test_1_27_custom *corev1.Namespace - parentNS *corev1.Namespace ) BeforeEach(func() { From 03dcbf1ef2294e7e962f165caf28202e2ae607dd Mon Sep 17 00:00:00 2001 From: Anand Kumar Singh Date: Fri, 28 Aug 2026 18:36:48 +0530 Subject: [PATCH 06/18] fix: 1-040 Signed-off-by: Anand Kumar Singh --- .../e2e/ginkgo/fixture/argocd/fixture.go | 5 +++ ...0_validate_quoted_RBAC_group_names_test.go | 44 +++++++++++++++---- 2 files changed, 40 insertions(+), 9 deletions(-) diff --git a/test/openshift/e2e/ginkgo/fixture/argocd/fixture.go b/test/openshift/e2e/ginkgo/fixture/argocd/fixture.go index 712b623e807..8d6fd33d488 100644 --- a/test/openshift/e2e/ginkgo/fixture/argocd/fixture.go +++ b/test/openshift/e2e/ginkgo/fixture/argocd/fixture.go @@ -353,6 +353,11 @@ func LogInToArgoCDInstanceWithoutRoute(instanceName, namespace string) (func(), // portForwardArgoCD starts kubectl port-forward and returns a cancel func. // Blocks until the tunnel is ready (or Fail()s after 60s). func portForwardArgoCD(namespace, subject, port string) func() { + // Kill any stale process on the local port left by a previous crashed run. + localPort := strings.SplitN(port, ":", 2)[0] + // #nosec G204 + _ = exec.Command("sh", "-c", "lsof -ti :"+localPort+" | xargs kill -9 2>/dev/null; fuser -k "+localPort+"/tcp 2>/dev/null; true").Run() + cmd := exec.Command("kubectl", "port-forward", "-n", namespace, subject, port) // #nosec G204 stdout, err := cmd.StdoutPipe() 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 840326735df..b6c6163c375 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,12 +1,16 @@ package sequential import ( + "context" "strings" + "github.com/argoproj-labs/argocd-operator/api/v1beta1" . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" "github.com/redhat-developer/gitops-operator/test/openshift/e2e/ginkgo/fixture" argocdFixture "github.com/redhat-developer/gitops-operator/test/openshift/e2e/ginkgo/fixture/argocd" + "github.com/redhat-developer/gitops-operator/test/openshift/e2e/ginkgo/fixture/utils" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" ) var _ = Describe("GitOps Operator Sequential E2E Tests", func() { @@ -14,31 +18,53 @@ var _ = Describe("GitOps Operator Sequential E2E Tests", func() { Context("1-040-validate_quoted_RBAC_group_names", func() { // TODO: check if this test can use a new ArgoCD instance instead of the default openshift-gitops instance + var ( + cancelPortForward func() + cleanupNamespace func() + ) + BeforeEach(func() { fixture.EnsureSequentialCleanSlate() + k8sClient, _ = utils.GetE2ETestKubeClient() + ctx = context.Background() + cancelPortForward = nil + cleanupNamespace = nil }) AfterEach(func() { - - // Delete the new role we created during the test - defer func() { + // Role deletion must happen while port-forward is still alive (before namespace cleanup kills the pods). + if cancelPortForward != nil { By("deleting the role we created during the test") _, err := argocdFixture.RunArgoCDCLI("proj", "role", "delete", "default", "somerole") Expect(err).ToNot(HaveOccurred()) - }() + cancelPortForward() + cancelPortForward = nil + } - fixture.OutputDebugOnFail() + if cleanupNamespace != nil { + cleanupNamespace() + cleanupNamespace = nil + } + fixture.OutputDebugOnFail() }) It("creates a project role 'somerole' and group claim, and verifies group claim contains the expected data", Label("openshift"), func() { - defaultArgoCD, err := argocdFixture.GetOpenShiftGitOpsNSArgoCD() - Expect(err).ToNot(HaveOccurred()) - Eventually(defaultArgoCD, "5m", "5s").Should(argocdFixture.BeAvailable()) + By("creating and checking ArgoCD instance is available") + namespace, cleanup := fixture.CreateRandomE2ETestNamespaceWithCleanupFunc() + cleanupNamespace = cleanup + argocd := &v1beta1.ArgoCD{ + ObjectMeta: metav1.ObjectMeta{Name: "argocd", Namespace: namespace.Name}, + } + Expect(k8sClient.Create(ctx, argocd)).To(Succeed()) + + Eventually(argocd, "5m", "5s").Should(argocdFixture.BeAvailable()) By("logging in to Argo CD instance") - Expect(argocdFixture.LogInToDefaultArgoCDInstance()).To(Succeed()) + var err error + cancelPortForward, err = argocdFixture.LogInToArgoCDInstanceWithoutRoute(argocd.Name, namespace.Name) + Expect(err).ToNot(HaveOccurred()) By("Creating a new 'somerole' role in default project") output, err := argocdFixture.RunArgoCDCLI("proj", "role", "create", "default", "somerole") From 218649b33158a75e739bb58392f2e13ebd04601d Mon Sep 17 00:00:00 2001 From: Anand Kumar Singh Date: Fri, 28 Aug 2026 23:10:47 +0530 Subject: [PATCH 07/18] fix: 1-052 Signed-off-by: Anand Kumar Singh --- .../1-052_validate_rolebinding_number_test.go | 22 ++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/test/openshift/e2e/ginkgo/sequential/1-052_validate_rolebinding_number_test.go b/test/openshift/e2e/ginkgo/sequential/1-052_validate_rolebinding_number_test.go index 172eaad0266..0accf083207 100644 --- a/test/openshift/e2e/ginkgo/sequential/1-052_validate_rolebinding_number_test.go +++ b/test/openshift/e2e/ginkgo/sequential/1-052_validate_rolebinding_number_test.go @@ -17,11 +17,16 @@ limitations under the License. package sequential import ( + "context" + + "github.com/argoproj-labs/argocd-operator/api/v1beta1" . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" "github.com/redhat-developer/gitops-operator/test/openshift/e2e/ginkgo/fixture" + argocdFixture "github.com/redhat-developer/gitops-operator/test/openshift/e2e/ginkgo/fixture/argocd" k8sFixture "github.com/redhat-developer/gitops-operator/test/openshift/e2e/ginkgo/fixture/k8s" namespaceFixture "github.com/redhat-developer/gitops-operator/test/openshift/e2e/ginkgo/fixture/namespace" + "github.com/redhat-developer/gitops-operator/test/openshift/e2e/ginkgo/fixture/utils" corev1 "k8s.io/api/core/v1" rbacv1 "k8s.io/api/rbac/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -34,20 +39,31 @@ var _ = Describe("GitOps Operator Sequential E2E Tests", func() { BeforeEach(func() { fixture.EnsureSequentialCleanSlate() + k8sClient, _ = utils.GetE2ETestKubeClient() + ctx = context.Background() }) It("verifies RoleBindings are added to namespace-scoped Namespace when that Namespace is managed by openshift-gitops", Label("openshift"), func() { + By("creating and checking ArgoCD instance is available") + namespace, cleanup := fixture.CreateRandomE2ETestNamespaceWithCleanupFunc() + defer cleanup() + argocd := &v1beta1.ArgoCD{ + ObjectMeta: metav1.ObjectMeta{Name: "argocd", Namespace: namespace.Name}, + } + Expect(k8sClient.Create(ctx, argocd)).To(Succeed()) + Eventually(argocd, "5m", "5s").Should(argocdFixture.BeAvailable()) + By("creating simple namespace-scoped Argo CD instance") ns, cleanupFunc := fixture.CreateRandomE2ETestNamespaceWithCleanupFunc() defer cleanupFunc() namespaceFixture.Update(ns, func(ns *corev1.Namespace) { - ns.Labels["argocd.argoproj.io/managed-by"] = "openshift-gitops" + ns.Labels["argocd.argoproj.io/managed-by"] = argocd.Namespace }) - roleBindingList := []string{"openshift-gitops-argocd-application-controller", - "openshift-gitops-argocd-server"} + roleBindingList := []string{argocd.Name + "-argocd-application-controller", + argocd.Name + "-argocd-server"} for _, rb := range roleBindingList { rb := &rbacv1.RoleBinding{ From a1749685490b3ceeca5097d62bad0a368d3e2213 Mon Sep 17 00:00:00 2001 From: Anand Kumar Singh Date: Sat, 29 Aug 2026 12:37:45 +0530 Subject: [PATCH 08/18] fix: 1-083 Signed-off-by: Anand Kumar Singh --- ...083_validate_apps_in_any_namespace_test.go | 237 +++++++++--------- 1 file changed, 120 insertions(+), 117 deletions(-) diff --git a/test/openshift/e2e/ginkgo/sequential/1-083_validate_apps_in_any_namespace_test.go b/test/openshift/e2e/ginkgo/sequential/1-083_validate_apps_in_any_namespace_test.go index 4379dc705a6..39997c4119f 100644 --- a/test/openshift/e2e/ginkgo/sequential/1-083_validate_apps_in_any_namespace_test.go +++ b/test/openshift/e2e/ginkgo/sequential/1-083_validate_apps_in_any_namespace_test.go @@ -42,7 +42,6 @@ import ( var _ = Describe("GitOps Operator Sequential E2E Tests", func() { Context("1-083_validate_apps_in_any_namespace", func() { - // TODO: check if this test can use a new ArgoCD instance instead of the default openshift-gitops instance var ( ctx context.Context @@ -55,32 +54,40 @@ var _ = Describe("GitOps Operator Sequential E2E Tests", func() { ctx = context.Background() }) - It("verifies that namespaces added to .spec.sourceNamespaces are managed by openshift-gitops Argo CD instance, except when those namespaces also have managed-by label. Both addition and removal of values from this field are tested", Label("openshift"), func() { + It("verifies that namespaces added to .spec.sourceNamespaces are managed by an Argo CD instance, except when those namespaces also have managed-by label. Both addition and removal of values from this field are tested", Label("openshift"), func() { - By("1) create test-1-24-custom namespace managed by openshift-gitops instance") + const argocdName = "argocd-083" - test_1_24_customNS, cleanupFunc := fixture.CreateManagedNamespaceWithCleanupFunc("test-1-24-custom", "openshift-gitops") - defer cleanupFunc() + By("creating a new ArgoCD instance") + argocdInstance, argocdNS, cleanupArgoCD := fixture.CreateNamespaceWithArgoCDInstance(argocdName) + defer cleanupArgoCD() - By("verifying openshift-gitops workloads exist and are running") + // sourceNamespaces reconciliation is gated on ARGOCD_CLUSTER_CONFIG_NAMESPACES in argocd-operator + fixture.SetEnvInOperatorSubscriptionOrDeployment("ARGOCD_CLUSTER_CONFIG_NAMESPACES", "openshift-gitops, "+argocdNS.Name) - openshiftGitOpsArgoCD, err := argocdFixture.GetOpenShiftGitOpsNSArgoCD() - Expect(err).ToNot(HaveOccurred()) + By("enabling ApplicationSet controller on argocd-083 instance") + argocdFixture.Update(argocdInstance, func(ac *v1beta1.ArgoCD) { + ac.Spec.ApplicationSet = &v1beta1.ArgoCDApplicationSet{} + }) + Eventually(argocdInstance, "5m", "5s").Should(argocdFixture.BeAvailable()) - Eventually(openshiftGitOpsArgoCD, "5m", "5s").Should(argocdFixture.BeAvailable()) + By("1) create test-1-24-custom namespace managed by argocd-083 instance") - deploymentsToVerify := []string{ - "openshift-gitops-redis", - "openshift-gitops-repo-server", - "openshift-gitops-server", - "openshift-gitops-applicationset-controller", - } + test_1_24_customNS, cleanupFunc := fixture.CreateManagedNamespaceWithCleanupFunc("test-1-24-custom", argocdNS.Name) + defer cleanupFunc() + + By("verifying argocd-083 workloads exist and are running") - for _, deploymentToVerify := range deploymentsToVerify { + for _, deploymentToVerify := range []string{ + argocdName + "-redis", + argocdName + "-repo-server", + argocdName + "-server", + argocdName + "-applicationset-controller", + } { depl := &appsv1.Deployment{ ObjectMeta: metav1.ObjectMeta{ Name: deploymentToVerify, - Namespace: "openshift-gitops", + Namespace: argocdNS.Name, }, } Eventually(depl).Should(k8sFixture.ExistByName()) @@ -88,23 +95,23 @@ var _ = Describe("GitOps Operator Sequential E2E Tests", func() { Eventually(depl, "2m", "5s").Should(deploymentFixture.HaveReadyReplicas(1)) } - appControllerSS := &appsv1.StatefulSet{ + argocdAppController := &appsv1.StatefulSet{ ObjectMeta: metav1.ObjectMeta{ - Name: "openshift-gitops-application-controller", - Namespace: "openshift-gitops", + Name: argocdName + "-application-controller", + Namespace: argocdNS.Name, }, } - Eventually(appControllerSS).Should(k8sFixture.ExistByName()) + Eventually(argocdAppController).Should(k8sFixture.ExistByName()) - Eventually(test_1_24_customNS).Should(namespaceFixture.HaveLabel("argocd.argoproj.io/managed-by", "openshift-gitops")) + Eventually(test_1_24_customNS).Should(namespaceFixture.HaveLabel("argocd.argoproj.io/managed-by", argocdNS.Name)) ensureRolesAndRoleBindingsHaveExpectedValuesInTest1_2_24Namespace := func() { - By("verifying that " + test_1_24_customNS.Name + " namespace has the expected server/app controller roles/rolebindings, and that the rolebindings grant access to openshift-gitops Argo CD instance") + By("verifying that " + test_1_24_customNS.Name + " namespace has the expected server/app controller roles/rolebindings, and that the rolebindings grant access to argocd-083 Argo CD instance") appControllerRole := &rbacv1.Role{ ObjectMeta: metav1.ObjectMeta{ - Name: "openshift-gitops-argocd-application-controller", + Name: argocdName + "-argocd-application-controller", Namespace: test_1_24_customNS.Name, }, } @@ -112,7 +119,7 @@ var _ = Describe("GitOps Operator Sequential E2E Tests", func() { serverRole := &rbacv1.Role{ ObjectMeta: metav1.ObjectMeta{ - Name: "openshift-gitops-argocd-server", + Name: argocdName + "-argocd-server", Namespace: test_1_24_customNS.Name, }, } @@ -120,7 +127,7 @@ var _ = Describe("GitOps Operator Sequential E2E Tests", func() { appcontrollerRoleBinding := &rbacv1.RoleBinding{ ObjectMeta: metav1.ObjectMeta{ - Name: "openshift-gitops-argocd-application-controller", + Name: argocdName + "-argocd-application-controller", Namespace: test_1_24_customNS.Name, }, } @@ -128,105 +135,101 @@ var _ = Describe("GitOps Operator Sequential E2E Tests", func() { Eventually(appcontrollerRoleBinding).Should(rolebindingFixture.HaveRoleRef(rbacv1.RoleRef{ APIGroup: "rbac.authorization.k8s.io", Kind: "Role", - Name: "openshift-gitops-argocd-application-controller", + Name: argocdName + "-argocd-application-controller", })) Eventually(appcontrollerRoleBinding).Should(rolebindingFixture.HaveSubject(rbacv1.Subject{ Kind: "ServiceAccount", - Name: "openshift-gitops-argocd-application-controller", - Namespace: "openshift-gitops", + Name: argocdName + "-argocd-application-controller", + Namespace: argocdNS.Name, })) argocdServerRoleBinding := &rbacv1.RoleBinding{ ObjectMeta: metav1.ObjectMeta{ - Name: "openshift-gitops-argocd-server", - Namespace: "test-1-24-custom", + Name: argocdName + "-argocd-server", + Namespace: test_1_24_customNS.Name, }, } Eventually(argocdServerRoleBinding).Should(k8sFixture.ExistByName()) Eventually(argocdServerRoleBinding).Should(rolebindingFixture.HaveRoleRef(rbacv1.RoleRef{ APIGroup: "rbac.authorization.k8s.io", Kind: "Role", - Name: "openshift-gitops-argocd-server", + Name: argocdName + "-argocd-server", })) Eventually(argocdServerRoleBinding).Should(rolebindingFixture.HaveSubject(rbacv1.Subject{ Kind: "ServiceAccount", - Name: "openshift-gitops-argocd-server", - Namespace: "openshift-gitops", + Name: argocdName + "-argocd-server", + Namespace: argocdNS.Name, })) } ensureRolesAndRoleBindingsHaveExpectedValuesInTest1_2_24Namespace() - By("2) Adding 'test-1-24-custom' as a source NS to openshift-gitops .spec.sourceNamespaces") + By("2) Adding 'test-1-24-custom' as a source NS to argocd-083 .spec.sourceNamespaces") - argocdFixture.Update(openshiftGitOpsArgoCD, func(ac *v1beta1.ArgoCD) { + argocdFixture.Update(argocdInstance, func(ac *v1beta1.ArgoCD) { ac.Spec.SourceNamespaces = []string{ "test-1-24-custom", } }) - By("verifying openshift-gitops instance should become ready") - openshiftGitOpsServer := &appsv1.Deployment{ + By("verifying argocd-083 instance should become ready") + argocdServer := &appsv1.Deployment{ ObjectMeta: metav1.ObjectMeta{ - Name: "openshift-gitops-server", - Namespace: "openshift-gitops", + Name: argocdName + "-server", + Namespace: argocdNS.Name, }, } - Eventually(openshiftGitOpsServer).Should(k8sFixture.ExistByName()) - Eventually(openshiftGitOpsServer, "3m", "5s").Should(deploymentFixture.HaveReplicas(1)) - Eventually(openshiftGitOpsServer, "3m", "5s").Should(deploymentFixture.HaveReadyReplicas(1)) + Eventually(argocdServer).Should(k8sFixture.ExistByName()) + Eventually(argocdServer, "3m", "5s").Should(deploymentFixture.HaveReplicas(1)) + Eventually(argocdServer, "3m", "5s").Should(deploymentFixture.HaveReadyReplicas(1)) - openshiftGitOpsAppController := &appsv1.StatefulSet{ - ObjectMeta: metav1.ObjectMeta{ - Name: "openshift-gitops-application-controller", - Namespace: "openshift-gitops", - }, - } - Eventually(openshiftGitOpsAppController).Should(k8sFixture.ExistByName()) - Eventually(openshiftGitOpsAppController).Should(statefulsetFixture.HaveReplicas(1)) - Eventually(openshiftGitOpsAppController).Should(statefulsetFixture.HaveReadyReplicas(1)) + Eventually(argocdAppController).Should(k8sFixture.ExistByName()) + Eventually(argocdAppController).Should(statefulsetFixture.HaveReplicas(1)) + Eventually(argocdAppController).Should(statefulsetFixture.HaveReadyReplicas(1)) By("verifing expected managed labels on test-1-24-custom, both managed-by and managed-by-cluster-argocd") - Eventually(test_1_24_customNS).Should(namespaceFixture.HaveLabel("argocd.argoproj.io/managed-by", "openshift-gitops")) + Eventually(test_1_24_customNS).Should(namespaceFixture.HaveLabel("argocd.argoproj.io/managed-by", argocdNS.Name)) ensureRolesAndRoleBindingsHaveExpectedValuesInTest1_2_24Namespace() - Eventually(test_1_24_customNS).ShouldNot(namespaceFixture.HaveLabel("argocd.argoproj.io/managed-by-cluster-argocd", "openshift-gitops")) + Eventually(test_1_24_customNS).ShouldNot(namespaceFixture.HaveLabel("argocd.argoproj.io/managed-by-cluster-argocd", argocdNS.Name)) + + sourceNSRoleName := argocdName + "_test-1-24-custom" - By("verify 'openshift-gitops_test-1-24-custom' role/rolebinding does not exist in test-1-24-custom") - openshift_gitops_test_1_24_customRole := &rbacv1.Role{ + By("verify '" + sourceNSRoleName + "' role/rolebinding does not exist in test-1-24-custom") + sourceNSRole := &rbacv1.Role{ ObjectMeta: metav1.ObjectMeta{ - Name: "openshift-gitops_test-1-24-custom", + Name: sourceNSRoleName, Namespace: "test-1-24-custom", }, } - Eventually(openshift_gitops_test_1_24_customRole).Should(k8sFixture.NotExistByName()) + Eventually(sourceNSRole).Should(k8sFixture.NotExistByName()) - openshift_gitops_test_1_24_customRoleBinding := &rbacv1.RoleBinding{ + sourceNSRoleBinding := &rbacv1.RoleBinding{ ObjectMeta: metav1.ObjectMeta{ - Name: "openshift-gitops_test-1-24-custom", + Name: sourceNSRoleName, Namespace: "test-1-24-custom", }, } - Eventually(openshift_gitops_test_1_24_customRoleBinding).Should(k8sFixture.NotExistByName()) + Eventually(sourceNSRoleBinding).Should(k8sFixture.NotExistByName()) By("3) Delete the 'test-1-24-custom' namespace. In this test, the main reason to do this is to remove the managed-by labels and any other remaining roles/rolebindings") Expect(k8sClient.Delete(ctx, test_1_24_customNS)).To(Succeed()) - By("4) Remove source namespace (added in previous steps) from openshift-gitops") + By("4) Remove source namespace (added in previous steps) from argocd-083") - argocdFixture.Update(openshiftGitOpsArgoCD, func(ac *v1beta1.ArgoCD) { + argocdFixture.Update(argocdInstance, func(ac *v1beta1.ArgoCD) { ac.Spec.SourceNamespaces = []string{} }) By("verifying Argo CD instance becomes ready") - Eventually(openshiftGitOpsServer).Should(k8sFixture.ExistByName()) - Eventually(openshiftGitOpsServer).Should(deploymentFixture.HaveReplicas(1)) - Eventually(openshiftGitOpsServer).Should(deploymentFixture.HaveReadyReplicas(1)) + Eventually(argocdServer).Should(k8sFixture.ExistByName()) + Eventually(argocdServer).Should(deploymentFixture.HaveReplicas(1)) + Eventually(argocdServer).Should(deploymentFixture.HaveReadyReplicas(1)) - Eventually(openshiftGitOpsAppController).Should(k8sFixture.ExistByName()) - Eventually(openshiftGitOpsAppController).Should(statefulsetFixture.HaveReplicas(1)) - Eventually(openshiftGitOpsAppController).Should(statefulsetFixture.HaveReadyReplicas(1)) + Eventually(argocdAppController).Should(k8sFixture.ExistByName()) + Eventually(argocdAppController).Should(statefulsetFixture.HaveReplicas(1)) + Eventually(argocdAppController).Should(statefulsetFixture.HaveReadyReplicas(1)) Eventually(test_1_24_customNS).Should(k8sFixture.NotExistByName()) @@ -238,66 +241,66 @@ var _ = Describe("GitOps Operator Sequential E2E Tests", func() { }, } Expect(k8sClient.Create(ctx, test_1_24_customNS)).To(Succeed()) - argocdFixture.Update(openshiftGitOpsArgoCD, func(ac *v1beta1.ArgoCD) { + argocdFixture.Update(argocdInstance, func(ac *v1beta1.ArgoCD) { ac.Spec.SourceNamespaces = []string{ "test-1-24-custom", } }) - By("verify openshift-gitops workloads become ready") - Eventually(openshiftGitOpsServer).Should(k8sFixture.ExistByName()) - Eventually(openshiftGitOpsServer).Should(deploymentFixture.HaveReplicas(1)) - Eventually(openshiftGitOpsServer).Should(deploymentFixture.HaveReadyReplicas(1)) + By("verify argocd-083 workloads become ready") + Eventually(argocdServer).Should(k8sFixture.ExistByName()) + Eventually(argocdServer).Should(deploymentFixture.HaveReplicas(1)) + Eventually(argocdServer).Should(deploymentFixture.HaveReadyReplicas(1)) - Eventually(openshiftGitOpsAppController).Should(k8sFixture.ExistByName()) - Eventually(openshiftGitOpsAppController).Should(statefulsetFixture.HaveReplicas(1)) - Eventually(openshiftGitOpsAppController).Should(statefulsetFixture.HaveReadyReplicas(1)) + Eventually(argocdAppController).Should(k8sFixture.ExistByName()) + Eventually(argocdAppController).Should(statefulsetFixture.HaveReplicas(1)) + Eventually(argocdAppController).Should(statefulsetFixture.HaveReadyReplicas(1)) By("verifying test-1-24-custom has managed-by-cluster-argocd label") - Eventually(test_1_24_customNS, "2m", "5s").Should(namespaceFixture.HaveLabel("argocd.argoproj.io/managed-by-cluster-argocd", "openshift-gitops")) + Eventually(test_1_24_customNS, "2m", "5s").Should(namespaceFixture.HaveLabel("argocd.argoproj.io/managed-by-cluster-argocd", argocdNS.Name)) - By("verify openshift-roles and rolebindings exist. In previous step, they would not exist due to labels on test-1-24-custom. NOW, in this step, they should.") - openshift_gitops_test_1_24_customRole = &rbacv1.Role{ + By("verify roles and rolebindings exist. In previous step, they would not exist due to labels on test-1-24-custom. NOW, in this step, they should.") + sourceNSRole = &rbacv1.Role{ ObjectMeta: metav1.ObjectMeta{ - Name: "openshift-gitops_test-1-24-custom", + Name: sourceNSRoleName, Namespace: "test-1-24-custom", }, } - Eventually(openshift_gitops_test_1_24_customRole).Should(k8sFixture.ExistByName()) + Eventually(sourceNSRole).Should(k8sFixture.ExistByName()) - openshift_gitops_test_1_24_customRoleBinding = &rbacv1.RoleBinding{ + sourceNSRoleBinding = &rbacv1.RoleBinding{ ObjectMeta: metav1.ObjectMeta{ - Name: "openshift-gitops_test-1-24-custom", + Name: sourceNSRoleName, Namespace: "test-1-24-custom", }, } - Eventually(openshift_gitops_test_1_24_customRoleBinding).Should(rolebindingFixture.HaveRoleRef(rbacv1.RoleRef{ + Eventually(sourceNSRoleBinding).Should(rolebindingFixture.HaveRoleRef(rbacv1.RoleRef{ APIGroup: "rbac.authorization.k8s.io", Kind: "Role", - Name: "openshift-gitops_test-1-24-custom", + Name: sourceNSRoleName, })) - Eventually(openshift_gitops_test_1_24_customRoleBinding).Should(rolebindingFixture.HaveSubject(rbacv1.Subject{ + Eventually(sourceNSRoleBinding).Should(rolebindingFixture.HaveSubject(rbacv1.Subject{ Kind: "ServiceAccount", - Name: "openshift-gitops-argocd-application-controller", - Namespace: "openshift-gitops", + Name: argocdName + "-argocd-application-controller", + Namespace: argocdNS.Name, })) By("6) Add the managed-by label to test-1-24-custom namespace") namespaceFixture.Update(test_1_24_customNS, func(n *corev1.Namespace) { - n.Labels["argocd.argoproj.io/managed-by"] = "openshift-gitops" + n.Labels["argocd.argoproj.io/managed-by"] = argocdNS.Name }) ensureRolesAndRoleBindingsHaveExpectedValuesInTest1_2_24Namespace() By("now that the managed-by label has been added, the custom roles should be deleted, and should stay deleted") - Eventually(openshift_gitops_test_1_24_customRole).ShouldNot(k8sFixture.ExistByName()) - Consistently(openshift_gitops_test_1_24_customRole).ShouldNot(k8sFixture.ExistByName()) + Eventually(sourceNSRole).ShouldNot(k8sFixture.ExistByName()) + Consistently(sourceNSRole).ShouldNot(k8sFixture.ExistByName()) - Eventually(openshift_gitops_test_1_24_customRoleBinding).ShouldNot(k8sFixture.ExistByName()) - Consistently(openshift_gitops_test_1_24_customRoleBinding).ShouldNot(k8sFixture.ExistByName()) + Eventually(sourceNSRoleBinding).ShouldNot(k8sFixture.ExistByName()) + Consistently(sourceNSRoleBinding).ShouldNot(k8sFixture.ExistByName()) - Eventually(test_1_24_customNS).ShouldNot(namespaceFixture.HaveLabel("argocd.argoproj.io/managed-by-cluster-argocd", "openshift-gitops")) + Eventually(test_1_24_customNS).ShouldNot(namespaceFixture.HaveLabel("argocd.argoproj.io/managed-by-cluster-argocd", argocdNS.Name)) By("7) Remove managed-by from test-1-24-custom and verify the roles exist again") namespaceFixture.Update(test_1_24_customNS, func(n *corev1.Namespace) { @@ -305,50 +308,50 @@ var _ = Describe("GitOps Operator Sequential E2E Tests", func() { }) By("restarts the server and app controller workloads. I presume this is because their startup is too slow to pick up the RBAC changes we have made (removing the label)") - _, err = osFixture.ExecCommand("oc", "rollout", "restart", "deployment.apps/openshift-gitops-server", "-n", "openshift-gitops") + _, err := osFixture.ExecCommand("oc", "rollout", "restart", "deployment.apps/"+argocdName+"-server", "-n", argocdNS.Name) Expect(err).ToNot(HaveOccurred()) - _, err = osFixture.ExecCommand("oc", "rollout", "restart", "statefulset.apps/openshift-gitops-application-controller", "-n", "openshift-gitops") + _, err = osFixture.ExecCommand("oc", "rollout", "restart", "statefulset.apps/"+argocdName+"-application-controller", "-n", argocdNS.Name) Expect(err).ToNot(HaveOccurred()) By("workloads should become available") - Eventually(openshiftGitOpsServer).Should(k8sFixture.ExistByName()) - Eventually(openshiftGitOpsServer).Should(deploymentFixture.HaveReplicas(1)) - Eventually(openshiftGitOpsServer).Should(deploymentFixture.HaveReadyReplicas(1)) + Eventually(argocdServer).Should(k8sFixture.ExistByName()) + Eventually(argocdServer).Should(deploymentFixture.HaveReplicas(1)) + Eventually(argocdServer).Should(deploymentFixture.HaveReadyReplicas(1)) - Eventually(openshiftGitOpsAppController).Should(k8sFixture.ExistByName()) - Eventually(openshiftGitOpsAppController).Should(statefulsetFixture.HaveReplicas(1)) - Eventually(openshiftGitOpsAppController).Should(statefulsetFixture.HaveReadyReplicas(1)) + Eventually(argocdAppController).Should(k8sFixture.ExistByName()) + Eventually(argocdAppController).Should(statefulsetFixture.HaveReplicas(1)) + Eventually(argocdAppController).Should(statefulsetFixture.HaveReadyReplicas(1)) - By("role rolebindings to openshift-gitops instance should exist") - Eventually(openshift_gitops_test_1_24_customRole).Should(k8sFixture.ExistByName()) + By("role rolebindings to argocd-083 instance should exist") + Eventually(sourceNSRole).Should(k8sFixture.ExistByName()) - Eventually(openshift_gitops_test_1_24_customRoleBinding).Should(rolebindingFixture.HaveRoleRef(rbacv1.RoleRef{ + Eventually(sourceNSRoleBinding).Should(rolebindingFixture.HaveRoleRef(rbacv1.RoleRef{ APIGroup: "rbac.authorization.k8s.io", Kind: "Role", - Name: "openshift-gitops_test-1-24-custom", + Name: sourceNSRoleName, })) - Eventually(openshift_gitops_test_1_24_customRoleBinding).Should(rolebindingFixture.HaveSubject(rbacv1.Subject{ + Eventually(sourceNSRoleBinding).Should(rolebindingFixture.HaveSubject(rbacv1.Subject{ Kind: "ServiceAccount", - Name: "openshift-gitops-argocd-application-controller", - Namespace: "openshift-gitops", + Name: argocdName + "-argocd-application-controller", + Namespace: argocdNS.Name, })) - Eventually(openshift_gitops_test_1_24_customRoleBinding).Should(rolebindingFixture.HaveSubject(rbacv1.Subject{ + Eventually(sourceNSRoleBinding).Should(rolebindingFixture.HaveSubject(rbacv1.Subject{ Kind: "ServiceAccount", - Name: "openshift-gitops-argocd-server", - Namespace: "openshift-gitops", + Name: argocdName + "-argocd-server", + Namespace: argocdNS.Name, })) By("8) Remove namespaces from .spec.sourceNamespaces") - argocdFixture.Update(openshiftGitOpsArgoCD, func(ac *v1beta1.ArgoCD) { + argocdFixture.Update(argocdInstance, func(ac *v1beta1.ArgoCD) { ac.Spec.SourceNamespaces = []string{} }) By("verifying managed-by-cluster-argocd label is removed, and the custom role/binding are deleted") - Eventually(test_1_24_customNS).ShouldNot(namespaceFixture.HaveLabel("argocd.argoproj.io/managed-by-cluster-argocd", "openshift-gitops")) + Eventually(test_1_24_customNS).ShouldNot(namespaceFixture.HaveLabel("argocd.argoproj.io/managed-by-cluster-argocd", argocdNS.Name)) - Eventually(openshift_gitops_test_1_24_customRole).Should(k8sFixture.NotExistByName()) - Eventually(openshift_gitops_test_1_24_customRoleBinding).Should(k8sFixture.NotExistByName()) + Eventually(sourceNSRole).Should(k8sFixture.NotExistByName()) + Eventually(sourceNSRoleBinding).Should(k8sFixture.NotExistByName()) }) }) From c394a6d6396664b21948147bea339a2f2cd44c00 Mon Sep 17 00:00:00 2001 From: Anand Kumar Singh Date: Sat, 29 Aug 2026 14:55:14 +0530 Subject: [PATCH 09/18] fix: 1-100 Signed-off-by: Anand Kumar Singh --- ...lidate_rollouts_resources_creation_test.go | 29 ++++++++++--------- 1 file changed, 16 insertions(+), 13 deletions(-) diff --git a/test/openshift/e2e/ginkgo/sequential/1-100_validate_rollouts_resources_creation_test.go b/test/openshift/e2e/ginkgo/sequential/1-100_validate_rollouts_resources_creation_test.go index f95179bc229..430f2819a64 100644 --- a/test/openshift/e2e/ginkgo/sequential/1-100_validate_rollouts_resources_creation_test.go +++ b/test/openshift/e2e/ginkgo/sequential/1-100_validate_rollouts_resources_creation_test.go @@ -20,7 +20,7 @@ import ( var _ = Describe("GitOps Operator Sequential E2E Tests", func() { Context("1-100_validate_rollouts_resources_creation", func() { - // TODO: check if this test can use a new ArgoCD instance instead of the default openshift-gitops instance + // TODO: check if this test can use a new ArgoCD instance instead of the default xks instance var ( ctx context.Context @@ -34,38 +34,41 @@ var _ = Describe("GitOps Operator Sequential E2E Tests", func() { ctx = context.Background() }) - It("creates a cluster-scopes Argo Rollouts instance and verifies the expected K8s resources are created", Label("openshift"), func() { + It("creates a cluster-scopes Argo Rollouts instance and verifies the expected K8s resources are created", Label("xks"), func() { - By("creating simple cluster-scoped Argo Rollouts instance via RolloutManager in openshift-gitops namespace") + namespace, cleanupNamespace := fixture.CreateNamespaceWithCleanupFunc("xks") + defer cleanupNamespace() + fixture.SetEnvInOperatorSubscriptionOrDeployment("CLUSTER_SCOPED_ARGO_ROLLOUTS_NAMESPACES", namespace.Name) + By("creating simple cluster-scoped Argo Rollouts instance via RolloutManager in xks namespace") rm := &rolloutmanagerv1alpha1.RolloutManager{ ObjectMeta: metav1.ObjectMeta{ Name: "example-rollout-manager", - Namespace: "openshift-gitops", + Namespace: namespace.Name, }, } Expect(k8sClient.Create(ctx, rm)).To(Succeed()) By("verifying all the expected K8s resources exist") - Eventually(&corev1.ServiceAccount{ObjectMeta: metav1.ObjectMeta{Name: "argo-rollouts", Namespace: "openshift-gitops"}}, "120s", "1s").Should(k8sFixture.ExistByName()) + Eventually(&corev1.ServiceAccount{ObjectMeta: metav1.ObjectMeta{Name: "argo-rollouts", Namespace: "xks"}}, "120s", "1s").Should(k8sFixture.ExistByName()) - Eventually(&rbacv1.ClusterRole{ObjectMeta: metav1.ObjectMeta{Name: "argo-rollouts", Namespace: "openshift-gitops"}}).Should(k8sFixture.ExistByName()) + Eventually(&rbacv1.ClusterRole{ObjectMeta: metav1.ObjectMeta{Name: "argo-rollouts", Namespace: "xks"}}).Should(k8sFixture.ExistByName()) - Eventually(&rbacv1.ClusterRoleBinding{ObjectMeta: metav1.ObjectMeta{Name: "argo-rollouts", Namespace: "openshift-gitops"}}).Should(k8sFixture.ExistByName()) + Eventually(&rbacv1.ClusterRoleBinding{ObjectMeta: metav1.ObjectMeta{Name: "argo-rollouts", Namespace: "xks"}}).Should(k8sFixture.ExistByName()) - Eventually(&rbacv1.ClusterRole{ObjectMeta: metav1.ObjectMeta{Name: "argo-rollouts-aggregate-to-admin", Namespace: "openshift-gitops"}}).Should(k8sFixture.ExistByName()) + Eventually(&rbacv1.ClusterRole{ObjectMeta: metav1.ObjectMeta{Name: "argo-rollouts-aggregate-to-admin", Namespace: "xks"}}).Should(k8sFixture.ExistByName()) - Eventually(&rbacv1.ClusterRole{ObjectMeta: metav1.ObjectMeta{Name: "argo-rollouts-aggregate-to-edit", Namespace: "openshift-gitops"}}).Should(k8sFixture.ExistByName()) + Eventually(&rbacv1.ClusterRole{ObjectMeta: metav1.ObjectMeta{Name: "argo-rollouts-aggregate-to-edit", Namespace: "xks"}}).Should(k8sFixture.ExistByName()) - Eventually(&rbacv1.ClusterRole{ObjectMeta: metav1.ObjectMeta{Name: "argo-rollouts-aggregate-to-view", Namespace: "openshift-gitops"}}).Should(k8sFixture.ExistByName()) + Eventually(&rbacv1.ClusterRole{ObjectMeta: metav1.ObjectMeta{Name: "argo-rollouts-aggregate-to-view", Namespace: "xks"}}).Should(k8sFixture.ExistByName()) - Eventually(&corev1.Secret{ObjectMeta: metav1.ObjectMeta{Name: "argo-rollouts-notification-secret", Namespace: "openshift-gitops"}}).Should(k8sFixture.ExistByName()) + Eventually(&corev1.Secret{ObjectMeta: metav1.ObjectMeta{Name: "argo-rollouts-notification-secret", Namespace: "xks"}}).Should(k8sFixture.ExistByName()) - depl := &appsv1.Deployment{ObjectMeta: metav1.ObjectMeta{Name: "argo-rollouts", Namespace: "openshift-gitops"}} + depl := &appsv1.Deployment{ObjectMeta: metav1.ObjectMeta{Name: "argo-rollouts", Namespace: "xks"}} Eventually(depl).Should(k8sFixture.ExistByName()) Eventually(depl, "4m", "5s").Should(deploymentFixture.HaveReadyReplicas(1)) - Eventually(&corev1.Service{ObjectMeta: metav1.ObjectMeta{Name: "argo-rollouts-metrics", Namespace: "openshift-gitops"}}).Should(k8sFixture.ExistByName()) + Eventually(&corev1.Service{ObjectMeta: metav1.ObjectMeta{Name: "argo-rollouts-metrics", Namespace: "xks"}}).Should(k8sFixture.ExistByName()) }) }) From c21c237183c260da2ca0e62f222cb73c47123bc8 Mon Sep 17 00:00:00 2001 From: Anand Kumar Singh Date: Sat, 29 Aug 2026 15:03:58 +0530 Subject: [PATCH 10/18] fix: 1-101 Signed-off-by: Anand Kumar Singh --- .../1-100_validate_rollouts_resources_creation_test.go | 1 - .../sequential/1-101_validate_rollout_policyrules_test.go | 6 +++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/test/openshift/e2e/ginkgo/sequential/1-100_validate_rollouts_resources_creation_test.go b/test/openshift/e2e/ginkgo/sequential/1-100_validate_rollouts_resources_creation_test.go index 430f2819a64..d641fedd8e4 100644 --- a/test/openshift/e2e/ginkgo/sequential/1-100_validate_rollouts_resources_creation_test.go +++ b/test/openshift/e2e/ginkgo/sequential/1-100_validate_rollouts_resources_creation_test.go @@ -20,7 +20,6 @@ import ( var _ = Describe("GitOps Operator Sequential E2E Tests", func() { Context("1-100_validate_rollouts_resources_creation", func() { - // TODO: check if this test can use a new ArgoCD instance instead of the default xks instance var ( ctx context.Context diff --git a/test/openshift/e2e/ginkgo/sequential/1-101_validate_rollout_policyrules_test.go b/test/openshift/e2e/ginkgo/sequential/1-101_validate_rollout_policyrules_test.go index 6218dccb8b4..294ec44d621 100644 --- a/test/openshift/e2e/ginkgo/sequential/1-101_validate_rollout_policyrules_test.go +++ b/test/openshift/e2e/ginkgo/sequential/1-101_validate_rollout_policyrules_test.go @@ -32,11 +32,15 @@ var _ = Describe("GitOps Operator Sequential E2E Tests", func() { It("verifying Rollouts operator creates the expected policy rules", Label("openshift"), func() { + namespace, cleanupNamespace := fixture.CreateRandomE2ETestNamespaceWithCleanupFunc() + defer cleanupNamespace() + fixture.SetEnvInOperatorSubscriptionOrDeployment("CLUSTER_SCOPED_ARGO_ROLLOUTS_NAMESPACES", namespace.Name) + By("creating cluster-scoped Argo Rollouts instance in openshift-gitops RolloutManager") rm := &rolloutmanagerv1alpha1.RolloutManager{ ObjectMeta: metav1.ObjectMeta{ Name: "example-rollout-manager", - Namespace: "openshift-gitops", + Namespace: namespace.Name, }, } Expect(k8sClient.Create(ctx, rm)).To(Succeed()) From f3492f8fb0a48226c5fa582ff030962c30cf7c62 Mon Sep 17 00:00:00 2001 From: Anand Kumar Singh Date: Sat, 29 Aug 2026 15:16:24 +0530 Subject: [PATCH 11/18] fix: 1-103 Signed-off-by: Anand Kumar Singh --- ...1-103-validate-rollouts-imagepullpolicy.go | 43 +++++++++++-------- 1 file changed, 26 insertions(+), 17 deletions(-) diff --git a/test/openshift/e2e/ginkgo/sequential/1-103-validate-rollouts-imagepullpolicy.go b/test/openshift/e2e/ginkgo/sequential/1-103-validate-rollouts-imagepullpolicy.go index f7ed4639749..0cf1ff64d70 100644 --- a/test/openshift/e2e/ginkgo/sequential/1-103-validate-rollouts-imagepullpolicy.go +++ b/test/openshift/e2e/ginkgo/sequential/1-103-validate-rollouts-imagepullpolicy.go @@ -35,11 +35,12 @@ import ( var _ = Describe("GitOps Operator Sequential E2E Tests", func() { Context("1-103_validate_rollouts_imagepullpolicy", func() { - // TODO: check if this test can use a new ArgoCD instance instead of the default openshift-gitops instance var ( - ctx context.Context - k8sClient client.Client + ctx context.Context + k8sClient client.Client + namespace *corev1.Namespace + cleanupNamespace func() ) BeforeEach(func() { @@ -47,6 +48,14 @@ var _ = Describe("GitOps Operator Sequential E2E Tests", func() { fixture.EnsureSequentialCleanSlate() k8sClient, _ = utils.GetE2ETestKubeClient() ctx = context.Background() + namespace, cleanupNamespace = fixture.CreateRandomE2ETestNamespaceWithCleanupFunc() + fixture.SetEnvInOperatorSubscriptionOrDeployment("CLUSTER_SCOPED_ARGO_ROLLOUTS_NAMESPACES", namespace.Name) + }) + + AfterEach(func() { + if cleanupNamespace != nil { + cleanupNamespace() + } }) It("creates a cluster-scopes Argo Rollouts instance and verifies the default image pull policy", Label("openshift"), func() { @@ -56,19 +65,19 @@ var _ = Describe("GitOps Operator Sequential E2E Tests", func() { rm := &rolloutmanagerv1alpha1.RolloutManager{ ObjectMeta: metav1.ObjectMeta{ Name: "example-rollout-manager", - Namespace: "openshift-gitops", + Namespace: namespace.Name, }, } Expect(k8sClient.Create(ctx, rm)).To(Succeed()) By("verifying deplyment exists") deplName := "argo-rollouts" - depl := &appsv1.Deployment{ObjectMeta: metav1.ObjectMeta{Name: deplName, Namespace: "openshift-gitops"}} + depl := &appsv1.Deployment{ObjectMeta: metav1.ObjectMeta{Name: deplName, Namespace: namespace.Name}} Eventually(depl).Should(k8sFixture.ExistByName()) Eventually(depl, "4m", "5s").Should(deploymentFixture.HaveReadyReplicas(1)) By("verifying deployment has ImagePullPolicy set to default(IfNotPresent)") - Eventually(deploymentFixture.VerifyDeploymentImagePullPolicy(deplName, "openshift-gitops", corev1.PullIfNotPresent), "3m", "5s").Should(BeTrue(), + Eventually(deploymentFixture.VerifyDeploymentImagePullPolicy(deplName, namespace.Name, corev1.PullIfNotPresent), "3m", "5s").Should(BeTrue(), "Deployment %s should have all containers with ImagePullPolicy set to IfNotPresent", deplName) }) @@ -80,7 +89,7 @@ var _ = Describe("GitOps Operator Sequential E2E Tests", func() { rm := &rolloutmanagerv1alpha1.RolloutManager{ ObjectMeta: metav1.ObjectMeta{ Name: "example-rollout-manager", - Namespace: "openshift-gitops", + Namespace: namespace.Name, }, Spec: rolloutmanagerv1alpha1.RolloutManagerSpec{ ImagePullPolicy: corev1.PullAlways, @@ -90,12 +99,12 @@ var _ = Describe("GitOps Operator Sequential E2E Tests", func() { By("verifying deplyment exists") deplName := "argo-rollouts" - depl := &appsv1.Deployment{ObjectMeta: metav1.ObjectMeta{Name: deplName, Namespace: "openshift-gitops"}} + depl := &appsv1.Deployment{ObjectMeta: metav1.ObjectMeta{Name: deplName, Namespace: namespace.Name}} Eventually(depl).Should(k8sFixture.ExistByName()) Eventually(depl, "4m", "5s").Should(deploymentFixture.HaveReadyReplicas(1)) By("verifying deployment has ImagePullPolicy set to the CR value(Always)") - Eventually(deploymentFixture.VerifyDeploymentImagePullPolicy(deplName, "openshift-gitops", corev1.PullAlways), "3m", "5s").Should(BeTrue(), + Eventually(deploymentFixture.VerifyDeploymentImagePullPolicy(deplName, namespace.Name, corev1.PullAlways), "3m", "5s").Should(BeTrue(), "Deployment %s should have all containers with ImagePullPolicy set to Always", deplName) By("updating the RolloutManager CR to set imagePullPolicy to Never") @@ -104,7 +113,7 @@ var _ = Describe("GitOps Operator Sequential E2E Tests", func() { Expect(k8sClient.Patch(ctx, rm, patch)).To(Succeed()) By("verifying deployment has ImagePullPolicy set to the CR value(Never)") - Eventually(deploymentFixture.VerifyDeploymentImagePullPolicy(deplName, "openshift-gitops", corev1.PullNever), "3m", "5s").Should(BeTrue(), + Eventually(deploymentFixture.VerifyDeploymentImagePullPolicy(deplName, namespace.Name, corev1.PullNever), "3m", "5s").Should(BeTrue(), "Deployment %s should have all containers with ImagePullPolicy set to Never", deplName) By("Removing the imagePullPolicy from the CR and check if the deployment has the imagePullPolicy set to default(IfNotPresent)") @@ -112,7 +121,7 @@ var _ = Describe("GitOps Operator Sequential E2E Tests", func() { Expect(k8sClient.Patch(ctx, rm, patch)).To(Succeed()) By("verifying deployment has ImagePullPolicy set to default(IfNotPresent)") - Eventually(deploymentFixture.VerifyDeploymentImagePullPolicy(deplName, "openshift-gitops", corev1.PullIfNotPresent), "3m", "5s").Should(BeTrue(), + Eventually(deploymentFixture.VerifyDeploymentImagePullPolicy(deplName, namespace.Name, corev1.PullIfNotPresent), "3m", "5s").Should(BeTrue(), "Deployment %s should have all containers with ImagePullPolicy set to IfNotPresent", deplName) }) @@ -133,40 +142,40 @@ var _ = Describe("GitOps Operator Sequential E2E Tests", func() { rm := &rolloutmanagerv1alpha1.RolloutManager{ ObjectMeta: metav1.ObjectMeta{ Name: "example-rollout-manager", - Namespace: "openshift-gitops", + Namespace: namespace.Name, }, } Expect(k8sClient.Create(ctx, rm)).To(Succeed()) By("verifying deplyment exists") deplName := "argo-rollouts" - depl := &appsv1.Deployment{ObjectMeta: metav1.ObjectMeta{Name: deplName, Namespace: "openshift-gitops"}} + depl := &appsv1.Deployment{ObjectMeta: metav1.ObjectMeta{Name: deplName, Namespace: namespace.Name}} Eventually(depl).Should(k8sFixture.ExistByName()) Eventually(depl, "4m", "5s").Should(deploymentFixture.HaveReadyReplicas(1)) By("verifying deployment has ImagePullPolicy set to Always") - Eventually(deploymentFixture.VerifyDeploymentImagePullPolicy(deplName, "openshift-gitops", corev1.PullAlways), "3m", "5s").Should(BeTrue(), + Eventually(deploymentFixture.VerifyDeploymentImagePullPolicy(deplName, namespace.Name, corev1.PullAlways), "3m", "5s").Should(BeTrue(), "Deployment %s should have all containers with ImagePullPolicy set to Always", deplName) By("changing the subscription image pull policy to Never") fixture.SetEnvInOperatorSubscriptionOrDeployment("IMAGE_PULL_POLICY", "Never") By("verifying deployment has ImagePullPolicy set to Never") - Eventually(deploymentFixture.VerifyDeploymentImagePullPolicy(deplName, "openshift-gitops", corev1.PullNever), "3m", "5s").Should(BeTrue(), + Eventually(deploymentFixture.VerifyDeploymentImagePullPolicy(deplName, namespace.Name, corev1.PullNever), "3m", "5s").Should(BeTrue(), "Deployment %s should have all containers with ImagePullPolicy set to Never", deplName) By("changing the subscription image pull policy to IfNotPresent") fixture.SetEnvInOperatorSubscriptionOrDeployment("IMAGE_PULL_POLICY", "IfNotPresent") By("verifying deployment has ImagePullPolicy set to IfNotPresent") - Eventually(deploymentFixture.VerifyDeploymentImagePullPolicy(deplName, "openshift-gitops", corev1.PullIfNotPresent), "3m", "5s").Should(BeTrue(), + Eventually(deploymentFixture.VerifyDeploymentImagePullPolicy(deplName, namespace.Name, corev1.PullIfNotPresent), "3m", "5s").Should(BeTrue(), "Deployment %s should have all containers with ImagePullPolicy set to IfNotPresent", deplName) By("setting imagePullPolicy in CR and verify if the deployment has the imagePullPolicy set to the CR value") patch := client.MergeFrom(rm.DeepCopy()) rm.Spec.ImagePullPolicy = corev1.PullAlways Expect(k8sClient.Patch(ctx, rm, patch)).To(Succeed()) - Eventually(deploymentFixture.VerifyDeploymentImagePullPolicy(deplName, "openshift-gitops", corev1.PullAlways), "3m", "5s").Should(BeTrue(), + Eventually(deploymentFixture.VerifyDeploymentImagePullPolicy(deplName, namespace.Name, corev1.PullAlways), "3m", "5s").Should(BeTrue(), "Deployment %s should have all containers with ImagePullPolicy set to Always", deplName) }) From 5af060f6e27702df555fe68aed67454863f302c5 Mon Sep 17 00:00:00 2001 From: Anand Kumar Singh Date: Sat, 29 Aug 2026 16:58:25 +0530 Subject: [PATCH 12/18] fix: 1-112 Signed-off-by: Anand Kumar Singh --- ...112_validate_rollout_plugin_support_test.go | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/test/openshift/e2e/ginkgo/sequential/1-112_validate_rollout_plugin_support_test.go b/test/openshift/e2e/ginkgo/sequential/1-112_validate_rollout_plugin_support_test.go index 1ca0ae4ebff..92a7c6a2b2b 100644 --- a/test/openshift/e2e/ginkgo/sequential/1-112_validate_rollout_plugin_support_test.go +++ b/test/openshift/e2e/ginkgo/sequential/1-112_validate_rollout_plugin_support_test.go @@ -37,11 +37,15 @@ var _ = Describe("GitOps Operator Sequential E2E Tests", func() { It("verifies that custom traffic management and metrics plugins can be added to Argo Rollouts instance via RolloutManager CR", Label("openshift"), func() { + namespace, cleanupNamespace := fixture.CreateRandomE2ETestNamespaceWithCleanupFunc() + defer cleanupNamespace() + fixture.SetEnvInOperatorSubscriptionOrDeployment("CLUSTER_SCOPED_ARGO_ROLLOUTS_NAMESPACES", namespace.Name) + By("creating a new Argo Rollouts instance in openshift-gitops namespace, containing a custom traffic management plugin and a custom metrics plugin") rm := &rolloutmanagerv1alpha1.RolloutManager{ ObjectMeta: metav1.ObjectMeta{ Name: "example-rollout-manager", - Namespace: "openshift-gitops", + Namespace: namespace.Name, }, Spec: rolloutmanagerv1alpha1.RolloutManagerSpec{ Plugins: rolloutmanagerv1alpha1.Plugins{ @@ -71,7 +75,7 @@ var _ = Describe("GitOps Operator Sequential E2E Tests", func() { rolloutsServiceAcct := &corev1.ServiceAccount{ ObjectMeta: metav1.ObjectMeta{ Name: "argo-rollouts", - Namespace: "openshift-gitops", + Namespace: namespace.Name, }, } Eventually(rolloutsServiceAcct).Should(k8sFixture.ExistByName()) @@ -102,7 +106,7 @@ var _ = Describe("GitOps Operator Sequential E2E Tests", func() { secret := &corev1.Secret{ ObjectMeta: metav1.ObjectMeta{ Name: "argo-rollouts-notification-secret", - Namespace: "openshift-gitops", + Namespace: namespace.Name, }, } Eventually(secret).Should(k8sFixture.ExistByName()) @@ -110,7 +114,7 @@ var _ = Describe("GitOps Operator Sequential E2E Tests", func() { depl := &appsv1.Deployment{ ObjectMeta: metav1.ObjectMeta{ Name: "argo-rollouts", - Namespace: "openshift-gitops", + Namespace: namespace.Name, }, } Eventually(depl).Should(k8sFixture.ExistByName()) @@ -119,7 +123,7 @@ var _ = Describe("GitOps Operator Sequential E2E Tests", func() { metricsService := &corev1.Service{ ObjectMeta: metav1.ObjectMeta{ Name: "argo-rollouts-metrics", - Namespace: "openshift-gitops", + Namespace: namespace.Name, }, } Eventually(metricsService).Should(k8sFixture.ExistByName()) @@ -128,7 +132,7 @@ var _ = Describe("GitOps Operator Sequential E2E Tests", func() { rolloutsConfigMap := &corev1.ConfigMap{ ObjectMeta: metav1.ObjectMeta{ Name: "argo-rollouts-config", - Namespace: "openshift-gitops", + Namespace: namespace.Name, }, } Eventually(rolloutsConfigMap).Should(k8sFixture.ExistByName()) @@ -144,7 +148,7 @@ var _ = Describe("GitOps Operator Sequential E2E Tests", func() { location: https://github.com/argoproj-labs/rollouts-plugin-trafficrouter-gatewayapi/releases/download/v0.4.0/gatewayapi-plugin-linux-amd64 sha256: ""` - if fixture.EnvLocalRun() || fixture.EnvCI() { + if fixture.EnvLocalRun() || fixture.EnvCI() || fixture.EnvNonOLM() { // When running the operator locally, the value comes from 'DefaultOpenShiftRoutePluginURL' constant expectedTrafficRouterPluginsVal += ` - name: argoproj-labs/openshift From bbbd3aabf199cfcf16eda1ab00681385ee3dad05 Mon Sep 17 00:00:00 2001 From: Anand Kumar Singh Date: Sat, 29 Aug 2026 17:13:24 +0530 Subject: [PATCH 13/18] fix: 1-113 Signed-off-by: Anand Kumar Singh --- .../1-113_validate_controller_role_test.go | 34 +++++++++++++------ 1 file changed, 23 insertions(+), 11 deletions(-) diff --git a/test/openshift/e2e/ginkgo/sequential/1-113_validate_controller_role_test.go b/test/openshift/e2e/ginkgo/sequential/1-113_validate_controller_role_test.go index 369bc453367..64b99388d19 100644 --- a/test/openshift/e2e/ginkgo/sequential/1-113_validate_controller_role_test.go +++ b/test/openshift/e2e/ginkgo/sequential/1-113_validate_controller_role_test.go @@ -22,10 +22,10 @@ import ( "context" "reflect" + argov1beta1api "github.com/argoproj-labs/argocd-operator/api/v1beta1" . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" "github.com/redhat-developer/gitops-operator/test/openshift/e2e/ginkgo/fixture" - argocdFixture "github.com/redhat-developer/gitops-operator/test/openshift/e2e/ginkgo/fixture/argocd" k8sFixture "github.com/redhat-developer/gitops-operator/test/openshift/e2e/ginkgo/fixture/k8s" "github.com/redhat-developer/gitops-operator/test/openshift/e2e/ginkgo/fixture/utils" corev1 "k8s.io/api/core/v1" @@ -61,9 +61,12 @@ var _ = Describe("GitOps Operator Sequential E2E Tests", func() { Context("1-113_validate_controller_role", func() { var ( - ctx context.Context - k8sClient client.Client - testNS *corev1.Namespace + ctx context.Context + k8sClient client.Client + testNS *corev1.Namespace + ArgocdNamespace *corev1.Namespace + cleanupNamespace func() + argocdInstance *argov1beta1api.ArgoCD ) BeforeEach(func() { @@ -73,24 +76,33 @@ var _ = Describe("GitOps Operator Sequential E2E Tests", func() { }) AfterEach(func() { - fixture.OutputDebugOnFail(testNS, "openshift-gitops") + fixture.OutputDebugOnFail(testNS, ArgocdNamespace.Name) + if cleanupNamespace != nil { + cleanupNamespace() + } }) It("validates openshift-gitops application-controller Role aggregates admin ClusterRole rules and removes them on delete", Label("openshift"), func() { - By("creating a namespace managed by openshift-gitops") - testNS = fixture.CreateManagedNamespace("test-1-113-ns", "openshift-gitops") + By("creating a namespace and argocd instance for the test") + argocdInstance, ArgocdNamespace, cleanupNamespace = fixture.CreateNamespaceWithArgoCDInstance("test-1-113") + + By("setting the ARGOCD_CLUSTER_CONFIG_NAMESPACES environment variable to the namespace") + fixture.SetEnvInOperatorSubscriptionOrDeployment("ARGOCD_CLUSTER_CONFIG_NAMESPACES", argocdInstance.Namespace) + + By("creating a namespace managed by an argocd instance") + testNS = fixture.CreateManagedNamespace("test-1-113-ns", argocdInstance.Namespace) defer func() { Expect(k8sClient.Delete(ctx, testNS)).To(Succeed()) }() - openshiftGitopsArgoCD, err := argocdFixture.GetOpenShiftGitOpsNSArgoCD() - Expect(err).ToNot(HaveOccurred()) - Eventually(openshiftGitopsArgoCD, "5m", "5s").Should(argocdFixture.BeAvailable()) + // openshiftGitopsArgoCD, err := argocdFixture.GetOpenShiftGitOpsNSArgoCD() + // Expect(err).ToNot(HaveOccurred()) + // Eventually(openshiftGitopsArgoCD, "5m", "5s").Should(argocdFixture.BeAvailable()) appControllerRole := &rbacv1.Role{ ObjectMeta: metav1.ObjectMeta{ - Name: "openshift-gitops-argocd-application-controller", + Name: argocdInstance.Name + "-argocd-application-controller", Namespace: testNS.Name, }, } From 43cfbfea867bc59e4aca5ffcd98cf9166b54495e Mon Sep 17 00:00:00 2001 From: Anand Kumar Singh Date: Sat, 29 Aug 2026 18:05:18 +0530 Subject: [PATCH 14/18] fix: 1-114 Signed-off-by: Anand Kumar Singh --- .../1-114_validate_imagepullpolicy_test.go | 80 +++++++++++-------- 1 file changed, 47 insertions(+), 33 deletions(-) diff --git a/test/openshift/e2e/ginkgo/sequential/1-114_validate_imagepullpolicy_test.go b/test/openshift/e2e/ginkgo/sequential/1-114_validate_imagepullpolicy_test.go index 8f4d44f6654..b3febcd7625 100644 --- a/test/openshift/e2e/ginkgo/sequential/1-114_validate_imagepullpolicy_test.go +++ b/test/openshift/e2e/ginkgo/sequential/1-114_validate_imagepullpolicy_test.go @@ -31,6 +31,7 @@ import ( appsv1 "k8s.io/api/apps/v1" corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/utils/ptr" "sigs.k8s.io/controller-runtime/pkg/client" ) @@ -141,101 +142,114 @@ var _ = Describe("GitOps Operator Sequential E2E Tests", func() { It("verifies that imagePullPolicy works correctly on default openshift-gitops ArgoCD instance", Label("openshift"), func() { - openshiftGitopsArgoCD, err := argocdFixture.GetOpenShiftGitOpsNSArgoCD() - Expect(err).ToNot(HaveOccurred()) + By("creating a namespace and argocd instance for the test") + argocdInstance, ArgocdNamespace, cleanupNamespace := fixture.CreateNamespaceWithArgoCDInstance("test-1-114-1") + defer cleanupNamespace() + fixture.SetEnvInOperatorSubscriptionOrDeployment("ARGOCD_CLUSTER_CONFIG_NAMESPACES", ArgocdNamespace.Name) + argocdFixture.Update(argocdInstance, func(ac *argov1beta1api.ArgoCD) { + ac.Spec.ApplicationSet = &argov1beta1api.ArgoCDApplicationSet{ + Enabled: ptr.To(bool(true)), + } + }) By("verifying that the openshift-gitops ArgoCD instance exists and is available") - Eventually(openshiftGitopsArgoCD).Should(k8sFixture.ExistByName()) - Eventually(openshiftGitopsArgoCD).Should(argocdFixture.BeAvailable()) + Eventually(argocdInstance).Should(k8sFixture.ExistByName()) + Eventually(argocdInstance).Should(argocdFixture.BeAvailable()) By("updating openshift-gitops ArgoCD to set imagePullPolicy to Always") - argocdFixture.Update(openshiftGitopsArgoCD, func(ac *argov1beta1api.ArgoCD) { + argocdFixture.Update(argocdInstance, func(ac *argov1beta1api.ArgoCD) { ac.Spec.ImagePullPolicy = corev1.PullAlways }) defer func() { By("restoring openshift-gitops ArgoCD imagePullPolicy to default after test") - argocdFixture.Update(openshiftGitopsArgoCD, func(ac *argov1beta1api.ArgoCD) { + argocdFixture.Update(argocdInstance, func(ac *argov1beta1api.ArgoCD) { ac.Spec.ImagePullPolicy = "" }) }() By("waiting for ArgoCD to reconcile") - Eventually(openshiftGitopsArgoCD, "5m", "5s").Should(argocdFixture.BeAvailable()) + Eventually(argocdInstance, "5m", "5s").Should(argocdFixture.BeAvailable()) By("verifying openshift-gitops deployments have imagePullPolicy set to Always") deploymentNames := []string{ - "openshift-gitops-server", - "openshift-gitops-repo-server", - "openshift-gitops-redis", - "openshift-gitops-applicationset-controller", + argocdInstance.Name + "-server", + argocdInstance.Name + "-repo-server", + argocdInstance.Name + "-redis", + argocdInstance.Name + "-applicationset-controller", } for _, deplName := range deploymentNames { depl := &appsv1.Deployment{ - ObjectMeta: metav1.ObjectMeta{Name: deplName, Namespace: "openshift-gitops"}, + ObjectMeta: metav1.ObjectMeta{Name: deplName, Namespace: ArgocdNamespace.Name}, } Eventually(depl).Should(k8sFixture.ExistByName()) - Eventually(deployment.VerifyDeploymentImagePullPolicy(deplName, "openshift-gitops", corev1.PullAlways), "3m", "5s").Should(BeTrue(), - "openshift-gitops Deployment %s should have all containers with ImagePullPolicy set to Always", deplName) + Eventually(deployment.VerifyDeploymentImagePullPolicy(deplName, ArgocdNamespace.Name, corev1.PullAlways), "3m", "5s").Should(BeTrue(), + ArgocdNamespace.Name+" Deployment %s should have all containers with ImagePullPolicy set to Always", deplName) } By("verifying openshift-gitops statefulset has imagePullPolicy set to Always") ss := &appsv1.StatefulSet{ ObjectMeta: metav1.ObjectMeta{ - Name: "openshift-gitops-application-controller", - Namespace: "openshift-gitops", + Name: argocdInstance.Name + "-application-controller", + Namespace: ArgocdNamespace.Name, }, } Eventually(ss).Should(k8sFixture.ExistByName()) - Eventually(statefulsetFixture.VerifyStatefulSetImagePullPolicy("openshift-gitops-application-controller", "openshift-gitops", corev1.PullAlways, ss), "3m", "5s").Should(BeTrue(), - "openshift-gitops StatefulSet should have all containers with ImagePullPolicy set to Always") + Eventually(statefulsetFixture.VerifyStatefulSetImagePullPolicy(argocdInstance.Name+"-application-controller", ArgocdNamespace.Name, corev1.PullAlways, ss), "3m", "5s").Should(BeTrue(), + ArgocdNamespace.Name+" StatefulSet should have all containers with ImagePullPolicy set to Always") }) It("verifies default imagePullPolicy is applied to all ArgoCD workload resources when not specified in either CR spec or subscription", Label("openshift"), func() { - openshiftGitopsArgoCD, err := argocdFixture.GetOpenShiftGitOpsNSArgoCD() - Expect(err).ToNot(HaveOccurred()) + argocdInstance, ArgocdNamespace, cleanupNamespace := fixture.CreateNamespaceWithArgoCDInstance("test-1-114") + defer cleanupNamespace() + fixture.SetEnvInOperatorSubscriptionOrDeployment("ARGOCD_CLUSTER_CONFIG_NAMESPACES", ArgocdNamespace.Name) + argocdFixture.Update(argocdInstance, func(ac *argov1beta1api.ArgoCD) { + ac.Spec.ApplicationSet = &argov1beta1api.ArgoCDApplicationSet{ + Enabled: ptr.To(bool(true)), + } + }) By("verifying that the openshift-gitops ArgoCD instance exists and is available") - Eventually(openshiftGitopsArgoCD).Should(k8sFixture.ExistByName()) - Eventually(openshiftGitopsArgoCD).Should(argocdFixture.BeAvailable()) + Eventually(argocdInstance).Should(k8sFixture.ExistByName()) + Eventually(argocdInstance).Should(argocdFixture.BeAvailable()) By("waiting for ArgoCD to reconcile") - Eventually(openshiftGitopsArgoCD, "5m", "5s").Should(argocdFixture.BeAvailable()) + Eventually(argocdInstance, "5m", "5s").Should(argocdFixture.BeAvailable()) By("verifying openshift-gitops deployments have imagePullPolicy set to default(IfNotPresent)") deploymentNames := []string{ - "openshift-gitops-server", - "openshift-gitops-repo-server", - "openshift-gitops-redis", - "openshift-gitops-applicationset-controller", + argocdInstance.Name + "-server", + argocdInstance.Name + "-repo-server", + argocdInstance.Name + "-redis", + argocdInstance.Name + "-applicationset-controller", } for _, deplName := range deploymentNames { depl := &appsv1.Deployment{ - ObjectMeta: metav1.ObjectMeta{Name: deplName, Namespace: "openshift-gitops"}, + ObjectMeta: metav1.ObjectMeta{Name: deplName, Namespace: ArgocdNamespace.Name}, } Eventually(depl).Should(k8sFixture.ExistByName()) - Eventually(deployment.VerifyDeploymentImagePullPolicy(deplName, "openshift-gitops", corev1.PullIfNotPresent), "3m", "5s").Should(BeTrue(), + Eventually(deployment.VerifyDeploymentImagePullPolicy(deplName, ArgocdNamespace.Name, corev1.PullIfNotPresent), "3m", "5s").Should(BeTrue(), "openshift-gitops Deployment %s should have all containers with ImagePullPolicy set to default(IfNotPresent)", deplName) } By("verifying openshift-gitops statefulset has imagePullPolicy set to default(IfNotPresent)") ss := &appsv1.StatefulSet{ ObjectMeta: metav1.ObjectMeta{ - Name: "openshift-gitops-application-controller", - Namespace: "openshift-gitops", + Name: argocdInstance.Name + "-application-controller", + Namespace: ArgocdNamespace.Name, }, } Eventually(ss).Should(k8sFixture.ExistByName()) - Eventually(statefulsetFixture.VerifyStatefulSetImagePullPolicy("openshift-gitops-application-controller", "openshift-gitops", corev1.PullIfNotPresent, ss), "3m", "5s").Should(BeTrue(), - "openshift-gitops StatefulSet should have all containers with ImagePullPolicy set to default(PullIfNotPresent)") + Eventually(statefulsetFixture.VerifyStatefulSetImagePullPolicy(argocdInstance.Name+"-application-controller", ArgocdNamespace.Name, corev1.PullIfNotPresent, ss), "3m", "5s").Should(BeTrue(), + argocdInstance.Name+" StatefulSet should have all containers with ImagePullPolicy set to default(PullIfNotPresent)") }) From c71ed24fca0212c87caea414d42e9d9d3007a17d Mon Sep 17 00:00:00 2001 From: Anand Kumar Singh Date: Sat, 29 Aug 2026 19:52:45 +0530 Subject: [PATCH 15/18] fix: 1-120 update getArgoCDComponentImageAndVersion to use redhat images Signed-off-by: Anand Kumar Singh --- .../1-120_repo_server_system_ca_trust.go | 22 +++++++++++++------ 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/test/openshift/e2e/ginkgo/sequential/1-120_repo_server_system_ca_trust.go b/test/openshift/e2e/ginkgo/sequential/1-120_repo_server_system_ca_trust.go index 570e4c436d5..e64500109f4 100644 --- a/test/openshift/e2e/ginkgo/sequential/1-120_repo_server_system_ca_trust.go +++ b/test/openshift/e2e/ginkgo/sequential/1-120_repo_server_system_ca_trust.go @@ -27,7 +27,7 @@ import ( "github.com/onsi/gomega/gcustom" matcher "github.com/onsi/gomega/types" - "github.com/redhat-developer/gitops-operator/test/openshift/e2e/ginkgo/fixture/clusterserviceversion" + olmv1alpha1 "github.com/operator-framework/api/pkg/operators/v1alpha1" "k8s.io/apimachinery/pkg/util/rand" "k8s.io/client-go/util/retry" "sigs.k8s.io/controller-runtime/pkg/client/apiutil" @@ -899,13 +899,21 @@ func purgeCtbs() { // getArgoCDComponentImageAndVersion ensures rhel based image is used for testing this. // If this is installed as a full-blown operator, use its images. // If not, inject bleeding-edge pre-release rhel-based images. +// On xks (no OLM/CSV API), falls back to RHEL image — required because the operator's +// CA trust init container uses RHEL-specific tools (update-ca-trust, trust). func getArgoCDComponentImageAndVersion() (string, string) { - csv := clusterserviceversion.Get(ctx, k8sClient) - if csv != nil { - for _, image := range csv.Spec.RelatedImages { - if image.Name == "argocd_image" { - By("Detected operator image " + image.Image + ". Using it") - return "", "" + var csvList olmv1alpha1.ClusterServiceVersionList + if err := k8sClient.List(ctx, &csvList, client.InNamespace("openshift-gitops-operator")); err == nil { + for idx := range csvList.Items { + idxCSV := csvList.Items[idx] + if !strings.Contains(idxCSV.Name, "gitops-operator") { + continue + } + for _, img := range idxCSV.Spec.RelatedImages { + if img.Name == "argocd_image" { + By("Detected operator image " + img.Image + ". Using it") + return "", "" + } } } } From 5b1ea9b99996c184430f3fcaffb7d23d0e226d03 Mon Sep 17 00:00:00 2001 From: Anand Kumar Singh Date: Sun, 30 Aug 2026 09:25:30 +0530 Subject: [PATCH 16/18] fix: remove label from fixed tests Signed-off-by: Anand Kumar Singh --- .../sequential/1-006_validate_machine_config_test.go | 2 +- .../sequential/1-020_validate_redis_ha_nonha_test.go | 2 +- .../1-035_validate_argocd_secret_repopulate_test.go | 2 +- .../1-040_validate_quoted_RBAC_group_names_test.go | 2 +- .../sequential/1-052_validate_rolebinding_number_test.go | 2 +- .../sequential/1-064_validate_tcp_reset_error_test.go | 7 +++---- .../1-083_validate_apps_in_any_namespace_test.go | 2 +- .../1-100_validate_rollouts_resources_creation_test.go | 2 +- .../sequential/1-101_validate_rollout_policyrules_test.go | 2 +- .../sequential/1-103-validate-rollouts-imagepullpolicy.go | 6 +++--- .../sequential/1-113_validate_controller_role_test.go | 2 +- .../sequential/1-114_validate_imagepullpolicy_test.go | 4 ++-- 12 files changed, 17 insertions(+), 18 deletions(-) diff --git a/test/openshift/e2e/ginkgo/sequential/1-006_validate_machine_config_test.go b/test/openshift/e2e/ginkgo/sequential/1-006_validate_machine_config_test.go index 2085bec46c8..7b966ff3840 100644 --- a/test/openshift/e2e/ginkgo/sequential/1-006_validate_machine_config_test.go +++ b/test/openshift/e2e/ginkgo/sequential/1-006_validate_machine_config_test.go @@ -71,7 +71,7 @@ var _ = Describe("GitOps Operator Sequential E2E Tests", func() { } }) - It("verifies that repo server replicas can be modified via .spec.repo.replicas", Label("fixed"), func() { + It("verifies that repo server replicas can be modified via .spec.repo.replicas", func() { // The Application in this test deploys a cluster-scoped resource (config.openshift.io/v1 Image), // so the Argo CD instance must be cluster-scoped. That requires setting an env var on the operator, diff --git a/test/openshift/e2e/ginkgo/sequential/1-020_validate_redis_ha_nonha_test.go b/test/openshift/e2e/ginkgo/sequential/1-020_validate_redis_ha_nonha_test.go index a4d012ffc7b..d20d395e972 100644 --- a/test/openshift/e2e/ginkgo/sequential/1-020_validate_redis_ha_nonha_test.go +++ b/test/openshift/e2e/ginkgo/sequential/1-020_validate_redis_ha_nonha_test.go @@ -41,7 +41,7 @@ var _ = Describe("GitOps Operator Sequential E2E Tests", func() { fixture.EnsureSequentialCleanSlate() }) - It("validates Redis HA and Non-HA", Label("fixed"), func() { + It("validates Redis HA and Non-HA", func() { // This test enables HA, so it needs to be running on a cluster with at least 3 nodes node.ExpectHasAtLeastXNodes(3) diff --git a/test/openshift/e2e/ginkgo/sequential/1-035_validate_argocd_secret_repopulate_test.go b/test/openshift/e2e/ginkgo/sequential/1-035_validate_argocd_secret_repopulate_test.go index 0df0d88c1ef..def6436f42a 100644 --- a/test/openshift/e2e/ginkgo/sequential/1-035_validate_argocd_secret_repopulate_test.go +++ b/test/openshift/e2e/ginkgo/sequential/1-035_validate_argocd_secret_repopulate_test.go @@ -35,7 +35,7 @@ var _ = Describe("GitOps Operator Sequential E2E Tests", func() { ctx = context.Background() }) - It("verifies 'argocd-secret' secret is regenerated and we are able to login using that Secret", Label("openshift"), func() { + It("verifies 'argocd-secret' secret is regenerated and we are able to login using that Secret", func() { By("creating and checking ArgoCD instance is available") namespace, cleanup := fixture.CreateRandomE2ETestNamespaceWithCleanupFunc() 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 b6c6163c375..8a9f01b970f 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 @@ -49,7 +49,7 @@ var _ = Describe("GitOps Operator Sequential E2E Tests", func() { fixture.OutputDebugOnFail() }) - It("creates a project role 'somerole' and group claim, and verifies group claim contains the expected data", Label("openshift"), func() { + It("creates a project role 'somerole' and group claim, and verifies group claim contains the expected data", func() { By("creating and checking ArgoCD instance is available") namespace, cleanup := fixture.CreateRandomE2ETestNamespaceWithCleanupFunc() diff --git a/test/openshift/e2e/ginkgo/sequential/1-052_validate_rolebinding_number_test.go b/test/openshift/e2e/ginkgo/sequential/1-052_validate_rolebinding_number_test.go index 0accf083207..83480e8680b 100644 --- a/test/openshift/e2e/ginkgo/sequential/1-052_validate_rolebinding_number_test.go +++ b/test/openshift/e2e/ginkgo/sequential/1-052_validate_rolebinding_number_test.go @@ -43,7 +43,7 @@ var _ = Describe("GitOps Operator Sequential E2E Tests", func() { ctx = context.Background() }) - It("verifies RoleBindings are added to namespace-scoped Namespace when that Namespace is managed by openshift-gitops", Label("openshift"), func() { + It("verifies RoleBindings are added to namespace-scoped Namespace when that Namespace is managed by openshift-gitops", func() { By("creating and checking ArgoCD instance is available") namespace, cleanup := fixture.CreateRandomE2ETestNamespaceWithCleanupFunc() diff --git a/test/openshift/e2e/ginkgo/sequential/1-064_validate_tcp_reset_error_test.go b/test/openshift/e2e/ginkgo/sequential/1-064_validate_tcp_reset_error_test.go index 40c1c873aa5..ec0f9a4e360 100644 --- a/test/openshift/e2e/ginkgo/sequential/1-064_validate_tcp_reset_error_test.go +++ b/test/openshift/e2e/ginkgo/sequential/1-064_validate_tcp_reset_error_test.go @@ -67,7 +67,7 @@ var _ = Describe("GitOps Operator Sequential E2E Tests", func() { } }) - It("verifies that argocd cli app manifests command will succesfully retrieve app manifests, and tcp reset error will not occur", Label("openshift"), func() { + It("verifies that argocd cli app manifests command will successfully retrieve app manifests, and tcp reset error will not occur", Label("openshift"), func() { // This test is VERY similar to 1-027. @@ -82,9 +82,8 @@ var _ = Describe("GitOps Operator Sequential E2E Tests", func() { ObjectMeta: metav1.ObjectMeta{Name: "1-27-argocd", Namespace: openshiftgitopsArgoCD.Namespace}, Spec: argocdv1alpha1.ApplicationSpec{ Source: &argocdv1alpha1.ApplicationSource{ - Path: "./operator-acceptance/1-027_operand-from-git", - // TODO: Move this repository to a better location - RepoURL: "https://github.com/jannfis/operator-e2e-git", + Path: "./test/examples/operator-acceptance", + RepoURL: "https://github.com/redhat-developer/gitops-operator", TargetRevision: "HEAD", }, Destination: argocdv1alpha1.ApplicationDestination{ diff --git a/test/openshift/e2e/ginkgo/sequential/1-083_validate_apps_in_any_namespace_test.go b/test/openshift/e2e/ginkgo/sequential/1-083_validate_apps_in_any_namespace_test.go index 39997c4119f..e159fd9b276 100644 --- a/test/openshift/e2e/ginkgo/sequential/1-083_validate_apps_in_any_namespace_test.go +++ b/test/openshift/e2e/ginkgo/sequential/1-083_validate_apps_in_any_namespace_test.go @@ -54,7 +54,7 @@ var _ = Describe("GitOps Operator Sequential E2E Tests", func() { ctx = context.Background() }) - It("verifies that namespaces added to .spec.sourceNamespaces are managed by an Argo CD instance, except when those namespaces also have managed-by label. Both addition and removal of values from this field are tested", Label("openshift"), func() { + It("verifies that namespaces added to .spec.sourceNamespaces are managed by an Argo CD instance, except when those namespaces also have managed-by label. Both addition and removal of values from this field are tested", func() { const argocdName = "argocd-083" diff --git a/test/openshift/e2e/ginkgo/sequential/1-100_validate_rollouts_resources_creation_test.go b/test/openshift/e2e/ginkgo/sequential/1-100_validate_rollouts_resources_creation_test.go index d641fedd8e4..6c58cc63f3d 100644 --- a/test/openshift/e2e/ginkgo/sequential/1-100_validate_rollouts_resources_creation_test.go +++ b/test/openshift/e2e/ginkgo/sequential/1-100_validate_rollouts_resources_creation_test.go @@ -33,7 +33,7 @@ var _ = Describe("GitOps Operator Sequential E2E Tests", func() { ctx = context.Background() }) - It("creates a cluster-scopes Argo Rollouts instance and verifies the expected K8s resources are created", Label("xks"), func() { + It("creates a cluster-scopes Argo Rollouts instance and verifies the expected K8s resources are created", func() { namespace, cleanupNamespace := fixture.CreateNamespaceWithCleanupFunc("xks") defer cleanupNamespace() diff --git a/test/openshift/e2e/ginkgo/sequential/1-101_validate_rollout_policyrules_test.go b/test/openshift/e2e/ginkgo/sequential/1-101_validate_rollout_policyrules_test.go index 294ec44d621..e855a5b5f1a 100644 --- a/test/openshift/e2e/ginkgo/sequential/1-101_validate_rollout_policyrules_test.go +++ b/test/openshift/e2e/ginkgo/sequential/1-101_validate_rollout_policyrules_test.go @@ -30,7 +30,7 @@ var _ = Describe("GitOps Operator Sequential E2E Tests", func() { ctx = context.Background() }) - It("verifying Rollouts operator creates the expected policy rules", Label("openshift"), func() { + It("verifying Rollouts operator creates the expected policy rules", func() { namespace, cleanupNamespace := fixture.CreateRandomE2ETestNamespaceWithCleanupFunc() defer cleanupNamespace() diff --git a/test/openshift/e2e/ginkgo/sequential/1-103-validate-rollouts-imagepullpolicy.go b/test/openshift/e2e/ginkgo/sequential/1-103-validate-rollouts-imagepullpolicy.go index 0cf1ff64d70..cae13db799d 100644 --- a/test/openshift/e2e/ginkgo/sequential/1-103-validate-rollouts-imagepullpolicy.go +++ b/test/openshift/e2e/ginkgo/sequential/1-103-validate-rollouts-imagepullpolicy.go @@ -58,7 +58,7 @@ var _ = Describe("GitOps Operator Sequential E2E Tests", func() { } }) - It("creates a cluster-scopes Argo Rollouts instance and verifies the default image pull policy", Label("openshift"), func() { + It("creates a cluster-scopes Argo Rollouts instance and verifies the default image pull policy", func() { By("creating simple cluster-scoped Argo Rollouts instance via RolloutManager in openshift-gitops namespace") @@ -82,7 +82,7 @@ var _ = Describe("GitOps Operator Sequential E2E Tests", func() { }) - It("creates a cluster-scopes Argo Rollouts instance and verifies the CR value imagePullPolicy is applied", Label("openshift"), func() { + It("creates a cluster-scopes Argo Rollouts instance and verifies the CR value imagePullPolicy is applied", func() { By("creating simple cluster-scoped Argo Rollouts instance via RolloutManager in openshift-gitops namespace with imagePullPolicy set to Always") @@ -125,7 +125,7 @@ var _ = Describe("GitOps Operator Sequential E2E Tests", func() { "Deployment %s should have all containers with ImagePullPolicy set to IfNotPresent", deplName) }) - It("creates a cluster-scopes Argo Rollouts instance and verifies subscription image pull policy is applied", Label("openshift"), func() { + It("creates a cluster-scopes Argo Rollouts instance and verifies subscription image pull policy is applied", func() { if fixture.EnvLocalRun() { Skip("This test does not support local run, as when the controller is running locally there is no env var to modify") return diff --git a/test/openshift/e2e/ginkgo/sequential/1-113_validate_controller_role_test.go b/test/openshift/e2e/ginkgo/sequential/1-113_validate_controller_role_test.go index 64b99388d19..fde75c5755f 100644 --- a/test/openshift/e2e/ginkgo/sequential/1-113_validate_controller_role_test.go +++ b/test/openshift/e2e/ginkgo/sequential/1-113_validate_controller_role_test.go @@ -82,7 +82,7 @@ var _ = Describe("GitOps Operator Sequential E2E Tests", func() { } }) - It("validates openshift-gitops application-controller Role aggregates admin ClusterRole rules and removes them on delete", Label("openshift"), func() { + It("validates openshift-gitops application-controller Role aggregates admin ClusterRole rules and removes them on delete", func() { By("creating a namespace and argocd instance for the test") argocdInstance, ArgocdNamespace, cleanupNamespace = fixture.CreateNamespaceWithArgoCDInstance("test-1-113") diff --git a/test/openshift/e2e/ginkgo/sequential/1-114_validate_imagepullpolicy_test.go b/test/openshift/e2e/ginkgo/sequential/1-114_validate_imagepullpolicy_test.go index b3febcd7625..2e560a70a8d 100644 --- a/test/openshift/e2e/ginkgo/sequential/1-114_validate_imagepullpolicy_test.go +++ b/test/openshift/e2e/ginkgo/sequential/1-114_validate_imagepullpolicy_test.go @@ -140,7 +140,7 @@ var _ = Describe("GitOps Operator Sequential E2E Tests", func() { }) - It("verifies that imagePullPolicy works correctly on default openshift-gitops ArgoCD instance", Label("openshift"), func() { + It("verifies that imagePullPolicy works correctly on default openshift-gitops ArgoCD instance", func() { By("creating a namespace and argocd instance for the test") argocdInstance, ArgocdNamespace, cleanupNamespace := fixture.CreateNamespaceWithArgoCDInstance("test-1-114-1") @@ -203,7 +203,7 @@ var _ = Describe("GitOps Operator Sequential E2E Tests", func() { }) - It("verifies default imagePullPolicy is applied to all ArgoCD workload resources when not specified in either CR spec or subscription", Label("openshift"), func() { + It("verifies default imagePullPolicy is applied to all ArgoCD workload resources when not specified in either CR spec or subscription", func() { argocdInstance, ArgocdNamespace, cleanupNamespace := fixture.CreateNamespaceWithArgoCDInstance("test-1-114") defer cleanupNamespace() From 3fde5f386924cddceec8b69aa2364fc2a5a02ae8 Mon Sep 17 00:00:00 2001 From: Anand Kumar Singh Date: Mon, 31 Aug 2026 10:15:45 +0530 Subject: [PATCH 17/18] fix: missing argocd cli from GitHub Actions Signed-off-by: Anand Kumar Singh --- .github/workflows/kind-ci-automation.yaml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.github/workflows/kind-ci-automation.yaml b/.github/workflows/kind-ci-automation.yaml index 5580d654e24..4e4bd84f10d 100644 --- a/.github/workflows/kind-ci-automation.yaml +++ b/.github/workflows/kind-ci-automation.yaml @@ -63,6 +63,13 @@ jobs: run: | make install + - name: Install Argo CD cli tool + run: | + curl -fsSL -o /tmp/argocd-linux-amd64 https://github.com/argoproj/argo-cd/releases/latest/download/argocd-linux-amd64 + sudo install -m 555 /tmp/argocd-linux-amd64 /usr/local/bin/argocd + rm /tmp/argocd-linux-amd64 + argocd version --client + - name: Deploy operator run: | set -o pipefail From 42543a6524f2e7510562e7c0e532c2d8c19608fc Mon Sep 17 00:00:00 2001 From: Anand Kumar Singh Date: Mon, 31 Aug 2026 21:58:10 +0530 Subject: [PATCH 18/18] fix: use kubectl instead of oc Signed-off-by: Anand Kumar Singh --- .../sequential/1-083_validate_apps_in_any_namespace_test.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/openshift/e2e/ginkgo/sequential/1-083_validate_apps_in_any_namespace_test.go b/test/openshift/e2e/ginkgo/sequential/1-083_validate_apps_in_any_namespace_test.go index e159fd9b276..e311e85f868 100644 --- a/test/openshift/e2e/ginkgo/sequential/1-083_validate_apps_in_any_namespace_test.go +++ b/test/openshift/e2e/ginkgo/sequential/1-083_validate_apps_in_any_namespace_test.go @@ -308,10 +308,10 @@ var _ = Describe("GitOps Operator Sequential E2E Tests", func() { }) By("restarts the server and app controller workloads. I presume this is because their startup is too slow to pick up the RBAC changes we have made (removing the label)") - _, err := osFixture.ExecCommand("oc", "rollout", "restart", "deployment.apps/"+argocdName+"-server", "-n", argocdNS.Name) + _, err := osFixture.ExecCommand("kubectl", "rollout", "restart", "deployment.apps/"+argocdName+"-server", "-n", argocdNS.Name) Expect(err).ToNot(HaveOccurred()) - _, err = osFixture.ExecCommand("oc", "rollout", "restart", "statefulset.apps/"+argocdName+"-application-controller", "-n", argocdNS.Name) + _, err = osFixture.ExecCommand("kubectl", "rollout", "restart", "statefulset.apps/"+argocdName+"-application-controller", "-n", argocdNS.Name) Expect(err).ToNot(HaveOccurred()) By("workloads should become available")