From 49dbe4e8b71f98cc80d277f149af49c2356ea1eb Mon Sep 17 00:00:00 2001 From: Triona Doyle Date: Tue, 16 Dec 2025 13:10:49 +0000 Subject: [PATCH] Port 1-086_validate_applicationset_extra_command_args test to Ginkgo Signed-off-by: Triona Doyle --- ...idate_applicationset_extra_command_args.go | 88 +++++++++++++++++++ 1 file changed, 88 insertions(+) create mode 100644 test/openshift/e2e/ginkgo/parallel/1-086_validate_applicationset_extra_command_args.go diff --git a/test/openshift/e2e/ginkgo/parallel/1-086_validate_applicationset_extra_command_args.go b/test/openshift/e2e/ginkgo/parallel/1-086_validate_applicationset_extra_command_args.go new file mode 100644 index 000000000..b0e5d8a65 --- /dev/null +++ b/test/openshift/e2e/ginkgo/parallel/1-086_validate_applicationset_extra_command_args.go @@ -0,0 +1,88 @@ +package parallel + +import ( + "context" + + 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" + deplFixture "github.com/redhat-developer/gitops-operator/test/openshift/e2e/ginkgo/fixture/deployment" + k8sFixture "github.com/redhat-developer/gitops-operator/test/openshift/e2e/ginkgo/fixture/k8s" + fixtureUtils "github.com/redhat-developer/gitops-operator/test/openshift/e2e/ginkgo/fixture/utils" + 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" +) + +var _ = Describe("GitOps Operator Parallel E2E Tests", func() { + + Context("1-086_validate_applicationset_extra_command_args", func() { + + var ( + k8sClient client.Client + ctx context.Context + ns *corev1.Namespace + cleanupFunc func() + argoCD *argov1beta1api.ArgoCD + ) + + BeforeEach(func() { + fixture.EnsureParallelCleanSlate() + k8sClient, _ = fixtureUtils.GetE2ETestKubeClient() + ctx = context.Background() + }) + + AfterEach(func() { + defer cleanupFunc() + fixture.OutputDebugOnFail(ns) + }) + + It("validates that extra command arguments are added to the ApplicationSet controller deployment", func() { + + expectAppSetIsReady := func() { + Eventually(argoCD, "5m", "5s").Should(argocdFixture.BeAvailable()) + + appSetDepl := &appsv1.Deployment{ObjectMeta: metav1.ObjectMeta{Name: "argocd-applicationset-controller", Namespace: ns.Name}} + + Eventually(appSetDepl).Should(k8sFixture.ExistByName()) + Eventually(appSetDepl).Should(deplFixture.HaveReplicas(1)) + Eventually(appSetDepl).Should(deplFixture.HaveReadyReplicas(1)) + } + + By("creating simple namespace-scoped Argo CD instance with ApplicationSet enabled") + ns, cleanupFunc = fixture.CreateRandomE2ETestNamespaceWithCleanupFunc() + + argoCD = &argov1beta1api.ArgoCD{ + ObjectMeta: metav1.ObjectMeta{Name: "argocd", Namespace: ns.Name}, + Spec: argov1beta1api.ArgoCDSpec{ + ApplicationSet: &argov1beta1api.ArgoCDApplicationSet{}, + }, + } + Expect(k8sClient.Create(ctx, argoCD)).To(Succeed()) + + By("waiting for initial ApplicationSet controller instance to be ready") + expectAppSetIsReady() + + By("patching ArgoCD CR to add the extraCommandArgs") + argocdFixture.Update(argoCD, func(ac *argov1beta1api.ArgoCD) { + ac.Spec.ApplicationSet.ExtraCommandArgs = []string{"--enable-progressive-syncs"} + }) + + By("waiting for the ApplicationSet controller to reconcile and adopt the new arguments") + expectAppSetIsReady() + + //last Assertion + By("verifying the new command arguments are present in the Deployment spec") + appSetDepl := &appsv1.Deployment{ObjectMeta: metav1.ObjectMeta{Name: "argocd-applicationset-controller", Namespace: ns.Name}} + + expectedArg := "--enable-progressive-syncs" + + //command substring exists + Eventually(appSetDepl).Should(deplFixture.HaveContainerCommandSubstring(expectedArg, 0), + "Expected the applicationset-controller command to include the extra argument: %s", expectedArg) + }) + }) +})