From 5710f26f18475ec98b8935d053ed6115a4fe017e Mon Sep 17 00:00:00 2001 From: Alexandre Gaudreault Date: Fri, 6 Jun 2025 10:24:14 -0400 Subject: [PATCH 1/7] test gitops PR Signed-off-by: Alexandre Gaudreault --- go.mod | 4 +++- go.sum | 4 ++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index eec8cf14080b2..48e49faa2ee65 100644 --- a/go.mod +++ b/go.mod @@ -2,6 +2,8 @@ module github.com/argoproj/argo-cd/v3 go 1.24.3 +replace github.com/argoproj/gitops-engine => github.com/agaudreault/gitops-engine v0.7.1-0.20250606141133-32f56cd438c3 + require ( code.gitea.io/sdk/gitea v0.21.0 dario.cat/mergo v1.0.2 @@ -12,7 +14,7 @@ require ( github.com/Masterminds/sprig/v3 v3.3.0 github.com/TomOnTime/utfutil v1.0.0 github.com/alicebob/miniredis/v2 v2.34.0 - github.com/argoproj/gitops-engine v0.7.1-0.20250420064138-d65e9d92277d + github.com/argoproj/gitops-engine v0.0.0-00010101000000-000000000000 github.com/argoproj/notifications-engine v0.4.1-0.20250309174002-87bf0576a872 github.com/argoproj/pkg/v2 v2.0.1 github.com/aws/aws-sdk-go v1.55.7 diff --git a/go.sum b/go.sum index 8c8496ef02ad1..ad86f23db4b94 100644 --- a/go.sum +++ b/go.sum @@ -100,6 +100,8 @@ github.com/RocketChat/Rocket.Chat.Go.SDK v0.0.0-20240116134246-a8cbe886bab0 h1:z github.com/RocketChat/Rocket.Chat.Go.SDK v0.0.0-20240116134246-a8cbe886bab0/go.mod h1:rjP7sIipbZcagro/6TCk6X0ZeFT2eyudH5+fve/cbBA= github.com/TomOnTime/utfutil v1.0.0 h1:/0Ivgo2OjXJxo8i7zgvs7ewSFZMLwCRGm3P5Umowb90= github.com/TomOnTime/utfutil v1.0.0/go.mod h1:l9lZmOniizVSuIliSkEf87qivMRlSNzbdBFKjuLRg1c= +github.com/agaudreault/gitops-engine v0.7.1-0.20250606141133-32f56cd438c3 h1:XLeiAn1wXFK1DCSXiZPT9yD92I0GmT0+nKWp/h54D4Y= +github.com/agaudreault/gitops-engine v0.7.1-0.20250606141133-32f56cd438c3/go.mod h1:duVhxDW7M7M7+19IBCVth2REOS11gmqzTWwj4u8N7aQ= github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= @@ -113,8 +115,6 @@ github.com/anmitsu/go-shlex v0.0.0-20200514113438-38f4b401e2be h1:9AeTilPcZAjCFI github.com/anmitsu/go-shlex v0.0.0-20200514113438-38f4b401e2be/go.mod h1:ySMOLuWl6zY27l47sB3qLNK6tF2fkHG55UZxx8oIVo4= github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY= github.com/appscode/go v0.0.0-20191119085241-0887d8ec2ecc/go.mod h1:OawnOmAL4ZX3YaPdN+8HTNwBveT1jMsqP74moa9XUbE= -github.com/argoproj/gitops-engine v0.7.1-0.20250420064138-d65e9d92277d h1:NbaCC4ZX8aBB1gGByMf8CcSgL9ACwLSbXGKBl80XSa4= -github.com/argoproj/gitops-engine v0.7.1-0.20250420064138-d65e9d92277d/go.mod h1:8bIs7jN5U7iKEWU4fMzZfsYWa8ere+iU1rcTiwAtL3A= github.com/argoproj/notifications-engine v0.4.1-0.20250309174002-87bf0576a872 h1:ADGAdyN9ty0+RmTT/yn+xV9vwkqvLn9O1ccqeP0Zeas= github.com/argoproj/notifications-engine v0.4.1-0.20250309174002-87bf0576a872/go.mod h1:d1RazGXWvKRFv9//rg4MRRR7rbvbE7XLgTSMT5fITTE= github.com/argoproj/pkg/v2 v2.0.1 h1:O/gCETzB/3+/hyFL/7d/VM/6pSOIRWIiBOTb2xqAHvc= From 2f01b8f244d6aa6fc42f3e49ba176ad3e2e594f1 Mon Sep 17 00:00:00 2001 From: Alexandre Gaudreault Date: Fri, 6 Jun 2025 11:01:26 -0400 Subject: [PATCH 2/7] fix go mod Signed-off-by: Alexandre Gaudreault --- go.mod | 1 + go.sum | 6 ++++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/go.mod b/go.mod index 0690b1d1f4d4a..511cdbd8c7566 100644 --- a/go.mod +++ b/go.mod @@ -143,6 +143,7 @@ require ( github.com/PagerDuty/go-pagerduty v1.8.0 // indirect github.com/ProtonMail/go-crypto v1.1.6 // indirect github.com/RocketChat/Rocket.Chat.Go.SDK v0.0.0-20240116134246-a8cbe886bab0 // indirect + github.com/alicebob/gopher-json v0.0.0-20230218143504-906a9b012302 // indirect github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2 // indirect github.com/aws/aws-sdk-go-v2 v1.36.3 // indirect github.com/aws/aws-sdk-go-v2/config v1.29.9 // indirect diff --git a/go.sum b/go.sum index 87934a391b66d..defbb49d065bb 100644 --- a/go.sum +++ b/go.sum @@ -109,8 +109,10 @@ github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuy github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= github.com/alecthomas/units v0.0.0-20190717042225-c3de453c63f4/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= github.com/alecthomas/units v0.0.0-20190924025748-f65c72e2690d/go.mod h1:rBZYJk541a8SKzHPHnH3zbiI+7dagKZ0cgpgrD7Fyho= -github.com/alicebob/miniredis/v2 v2.35.0 h1:QwLphYqCEAo1eu1TqPRN2jgVMPBweeQcR21jeqDCONI= -github.com/alicebob/miniredis/v2 v2.35.0/go.mod h1:TcL7YfarKPGDAthEtl5NBeHZfeUQj6OXMm/+iu5cLMM= +github.com/alicebob/gopher-json v0.0.0-20230218143504-906a9b012302 h1:uvdUDbHQHO85qeSydJtItA4T55Pw6BtAejd0APRJOCE= +github.com/alicebob/gopher-json v0.0.0-20230218143504-906a9b012302/go.mod h1:SGnFV6hVsYE877CKEZ6tDNTjaSXYUk6QqoIK6PrAtcc= +github.com/alicebob/miniredis/v2 v2.34.0 h1:mBFWMaJSNL9RwdGRyEDoAAv8OQc5UlEhLDQggTglU/0= +github.com/alicebob/miniredis/v2 v2.34.0/go.mod h1:kWShP4b58T1CW0Y5dViCd5ztzrDqRWqM3nksiyXk5s8= github.com/anmitsu/go-shlex v0.0.0-20200514113438-38f4b401e2be h1:9AeTilPcZAjCFIImctFaOjnTIavg87rW78vTPkQqLI8= github.com/anmitsu/go-shlex v0.0.0-20200514113438-38f4b401e2be/go.mod h1:ySMOLuWl6zY27l47sB3qLNK6tF2fkHG55UZxx8oIVo4= github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY= From 3de080313d3d4a46fc0242ee1c9a955e25a912e6 Mon Sep 17 00:00:00 2001 From: Alexandre Gaudreault Date: Fri, 6 Jun 2025 13:48:17 -0400 Subject: [PATCH 3/7] add e2e Signed-off-by: Alexandre Gaudreault --- test/e2e/app_sync_options_test.go | 61 --------------- test/e2e/sync_options_test.go | 125 +++++++++++++++++++++++++++++- 2 files changed, 122 insertions(+), 64 deletions(-) delete mode 100644 test/e2e/app_sync_options_test.go diff --git a/test/e2e/app_sync_options_test.go b/test/e2e/app_sync_options_test.go deleted file mode 100644 index d1c8a620d03a3..0000000000000 --- a/test/e2e/app_sync_options_test.go +++ /dev/null @@ -1,61 +0,0 @@ -package e2e - -import ( - "testing" - - "github.com/argoproj/gitops-engine/pkg/health" - . "github.com/argoproj/gitops-engine/pkg/sync/common" - "github.com/stretchr/testify/assert" - corev1 "k8s.io/api/core/v1" - - . "github.com/argoproj/argo-cd/v3/pkg/apis/application/v1alpha1" - . "github.com/argoproj/argo-cd/v3/test/e2e/fixture" - . "github.com/argoproj/argo-cd/v3/test/e2e/fixture/app" -) - -// Given application is set with --sync-option CreateNamespace=true and --sync-option ServerSideApply=true -// -// application --dest-namespace exists -// -// Then, --dest-namespace is created with server side apply -// application is synced and healthy with resource -// application resources created with server side apply in the newly created namespace. -func TestNamespaceCreationWithSSA(t *testing.T) { - SkipOnEnv(t, "OPENSHIFT") - namespace := "guestbook-ui-with-ssa" - defer func() { - if !t.Skipped() { - _, err := Run("", "kubectl", "delete", "namespace", namespace) - assert.NoError(t, err) - } - }() - - ctx := Given(t) - ctx. - SetAppNamespace(AppNamespace()). - Timeout(30). - Path("guestbook"). - When(). - CreateFromFile(func(app *Application) { - app.Spec.SyncPolicy = &SyncPolicy{ - SyncOptions: SyncOptions{"CreateNamespace=true", "ServerSideApply=true"}, - } - }). - Then(). - Expect(NoNamespace(namespace)). - When(). - AppSet("--dest-namespace", namespace). - Sync(). - Then(). - Expect(Success("")). - Expect(Namespace(namespace, func(_ *Application, ns *corev1.Namespace) { - assert.NotContains(t, ns.Annotations, "kubectl.kubernetes.io/last-applied-configuration") - })). - Expect(SyncStatusIs(SyncStatusCodeSynced)). - Expect(HealthIs(health.HealthStatusHealthy)). - Expect(OperationPhaseIs(OperationSucceeded)). - Expect(ResourceHealthWithNamespaceIs("Deployment", "guestbook-ui", namespace, health.HealthStatusHealthy)). - Expect(ResourceSyncStatusWithNamespaceIs("Deployment", "guestbook-ui", namespace, SyncStatusCodeSynced)). - Expect(ResourceHealthWithNamespaceIs("Service", "guestbook-ui", namespace, health.HealthStatusHealthy)). - Expect(ResourceSyncStatusWithNamespaceIs("Service", "guestbook-ui", namespace, SyncStatusCodeSynced)) -} diff --git a/test/e2e/sync_options_test.go b/test/e2e/sync_options_test.go index 4a7786cc2fffe..a1f71bcb6b7b5 100644 --- a/test/e2e/sync_options_test.go +++ b/test/e2e/sync_options_test.go @@ -4,17 +4,89 @@ import ( "os" "testing" + "github.com/argoproj/gitops-engine/pkg/health" . "github.com/argoproj/gitops-engine/pkg/sync/common" + "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/types" . "github.com/argoproj/argo-cd/v3/pkg/apis/application/v1alpha1" "github.com/argoproj/argo-cd/v3/test/e2e/fixture" + . "github.com/argoproj/argo-cd/v3/test/e2e/fixture" . "github.com/argoproj/argo-cd/v3/test/e2e/fixture/app" "github.com/argoproj/argo-cd/v3/util/errors" ) +// TestSyncWithCreateNamespace verifies that the namespace is created when the +// CreateNamespace=true is provided as part of the normal sync resources +func TestSyncWithCreateNamespace(t *testing.T) { + newNamespace := getNewNamespace(t) + defer func() { + if !t.Skipped() { + errors.NewHandler(t).FailOnErr(fixture.Run("", "kubectl", "delete", "namespace", newNamespace)) + } + }() + + Given(t). + Path(guestbookPath). + When(). + CreateFromFile(func(app *Application) { + app.Spec.Destination.Namespace = newNamespace + app.Spec.SyncPolicy = &SyncPolicy{ + SyncOptions: SyncOptions{ + "CreateNamespace=true", + }, + } + }). + Then(). + Expect(SyncStatusIs(SyncStatusCodeOutOfSync)). + When(). + Sync(). + Then(). + // Only one resource should be in sync result + Expect(SyncStatusIs(SyncStatusCodeSynced)). + Expect(HealthIs(health.HealthStatusHealthy)). + Expect(OperationPhaseIs(OperationSucceeded)). + Expect(ResourceResultNumbering(3)) +} + +// TestSyncWithCreateNamespaceAndDryRunError verifies that the namespace is created before the +// DryRun validation is made on the resources, even if the sync fails. This allows transient errors +// to be resolved on sync retries +func TestSyncWithCreateNamespaceAndDryRunError(t *testing.T) { + newNamespace := getNewNamespace(t) + defer func() { + if !t.Skipped() { + errors.NewHandler(t).FailOnErr(fixture.Run("", "kubectl", "delete", "namespace", newNamespace)) + } + }() + + Given(t). + Path("failure-during-sync"). + When(). + CreateFromFile(func(app *Application) { + app.Spec.Destination.Namespace = newNamespace + app.Spec.SyncPolicy = &SyncPolicy{ + SyncOptions: SyncOptions{ + "CreateNamespace=true", + }, + } + }). + Then(). + Expect(SyncStatusIs(SyncStatusCodeOutOfSync)). + When(). + IgnoreErrors(). + Sync(). + Then(). + // Only one resource should be in sync result + Expect(OperationPhaseIs(OperationFailed)). + Expect(ResourceResultNumbering(2)). + Expect(ResourceSyncStatusIs("Namespace", newNamespace, SyncStatusCodeSynced)). + Expect(ResourceSyncStatusWithNamespaceIs("ServiceAccount", newNamespace, "failure-during-sync", "")) +} + // TestSyncOptionsValidateFalse verifies we can disable validation during kubectl apply, using the // 'argocd.argoproj.io/sync-options: Validate=false' sync option func TestSyncOptionsValidateFalse(t *testing.T) { @@ -53,7 +125,7 @@ func TestSyncWithStatusIgnored(t *testing.T) { Path(guestbookPath). When(). And(func() { - require.NoError(t, fixture.SetResourceOverrides(map[string]ResourceOverride{ + require.NoError(t, SetResourceOverrides(map[string]ResourceOverride{ "/": { IgnoreDifferences: OverrideIgnoreDiff{JSONPointers: []string{"/status"}}, }, @@ -73,7 +145,7 @@ func TestSyncWithStatusIgnored(t *testing.T) { // app should remain synced if k8s change detected When(). And(func() { - errors.NewHandler(t).FailOnErr(fixture.KubeClientset.AppsV1().Deployments(fixture.DeploymentNamespace()).Patch(t.Context(), + errors.NewHandler(t).FailOnErr(KubeClientset.AppsV1().Deployments(DeploymentNamespace()).Patch(t.Context(), "guestbook-ui", types.JSONPatchType, []byte(`[{ "op": "replace", "path": "/status/observedGeneration", "value": 2 }]`), metav1.PatchOptions{})) }). Then(). @@ -104,7 +176,7 @@ func TestSyncWithApplyOutOfSyncOnly(t *testing.T) { } func TestSyncWithSkipHook(t *testing.T) { - fixture.SkipOnEnv(t, "OPENSHIFT") + SkipOnEnv(t, "OPENSHIFT") Given(t). Path(guestbookPath). When(). @@ -146,3 +218,50 @@ func TestSyncWithForceReplace(t *testing.T) { Then(). Expect(SyncStatusIs(SyncStatusCodeSynced)) } + +// Given application is set with --sync-option CreateNamespace=true and --sync-option ServerSideApply=true +// +// application --dest-namespace exists +// +// Then, --dest-namespace is created with server side apply +// application is synced and healthy with resource +// application resources created with server side apply in the newly created namespace. +func TestNamespaceCreationWithSSA(t *testing.T) { + SkipOnEnv(t, "OPENSHIFT") + namespace := "guestbook-ui-with-ssa" + defer func() { + if !t.Skipped() { + _, err := Run("", "kubectl", "delete", "namespace", namespace) + assert.NoError(t, err) + } + }() + + ctx := Given(t) + ctx. + SetAppNamespace(AppNamespace()). + Timeout(30). + Path("guestbook"). + When(). + CreateFromFile(func(app *Application) { + app.Spec.SyncPolicy = &SyncPolicy{ + SyncOptions: SyncOptions{"CreateNamespace=true", "ServerSideApply=true"}, + } + }). + Then(). + Expect(NoNamespace(namespace)). + When(). + AppSet("--dest-namespace", namespace). + Sync(). + Then(). + Expect(Success("")). + Expect(Namespace(namespace, func(_ *Application, ns *corev1.Namespace) { + assert.NotContains(t, ns.Annotations, "kubectl.kubernetes.io/last-applied-configuration") + })). + Expect(SyncStatusIs(SyncStatusCodeSynced)). + Expect(HealthIs(health.HealthStatusHealthy)). + Expect(OperationPhaseIs(OperationSucceeded)). + Expect(ResourceHealthWithNamespaceIs("Deployment", "guestbook-ui", namespace, health.HealthStatusHealthy)). + Expect(ResourceSyncStatusWithNamespaceIs("Deployment", "guestbook-ui", namespace, SyncStatusCodeSynced)). + Expect(ResourceHealthWithNamespaceIs("Service", "guestbook-ui", namespace, health.HealthStatusHealthy)). + Expect(ResourceSyncStatusWithNamespaceIs("Service", "guestbook-ui", namespace, SyncStatusCodeSynced)) +} From 34df8d952dfaeddf66ebadc0852141b978423115 Mon Sep 17 00:00:00 2001 From: Alexandre Gaudreault Date: Fri, 6 Jun 2025 14:19:31 -0400 Subject: [PATCH 4/7] lint Signed-off-by: Alexandre Gaudreault --- test/e2e/sync_options_test.go | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/test/e2e/sync_options_test.go b/test/e2e/sync_options_test.go index a1f71bcb6b7b5..97b8abd3ad172 100644 --- a/test/e2e/sync_options_test.go +++ b/test/e2e/sync_options_test.go @@ -13,7 +13,6 @@ import ( "k8s.io/apimachinery/pkg/types" . "github.com/argoproj/argo-cd/v3/pkg/apis/application/v1alpha1" - "github.com/argoproj/argo-cd/v3/test/e2e/fixture" . "github.com/argoproj/argo-cd/v3/test/e2e/fixture" . "github.com/argoproj/argo-cd/v3/test/e2e/fixture/app" "github.com/argoproj/argo-cd/v3/util/errors" @@ -25,7 +24,7 @@ func TestSyncWithCreateNamespace(t *testing.T) { newNamespace := getNewNamespace(t) defer func() { if !t.Skipped() { - errors.NewHandler(t).FailOnErr(fixture.Run("", "kubectl", "delete", "namespace", newNamespace)) + errors.NewHandler(t).FailOnErr(Run("", "kubectl", "delete", "namespace", newNamespace)) } }() @@ -59,7 +58,7 @@ func TestSyncWithCreateNamespaceAndDryRunError(t *testing.T) { newNamespace := getNewNamespace(t) defer func() { if !t.Skipped() { - errors.NewHandler(t).FailOnErr(fixture.Run("", "kubectl", "delete", "namespace", newNamespace)) + errors.NewHandler(t).FailOnErr(Run("", "kubectl", "delete", "namespace", newNamespace)) } }() From 16dd3b2903ef19ea398aa900e8b44def13fcd8a0 Mon Sep 17 00:00:00 2001 From: Alexandre Gaudreault Date: Mon, 9 Jun 2025 10:00:40 -0400 Subject: [PATCH 5/7] fix tests Signed-off-by: Alexandre Gaudreault --- go.mod | 2 +- go.sum | 4 ++-- test/e2e/sync_options_test.go | 12 +++++------- 3 files changed, 8 insertions(+), 10 deletions(-) diff --git a/go.mod b/go.mod index 8a2706a57aa3d..66bbb0d08f866 100644 --- a/go.mod +++ b/go.mod @@ -2,7 +2,7 @@ module github.com/argoproj/argo-cd/v3 go 1.24.4 -replace github.com/argoproj/gitops-engine => github.com/agaudreault/gitops-engine v0.7.1-0.20250606175117-1fac77f9a2f3 +replace github.com/argoproj/gitops-engine => github.com/agaudreault/gitops-engine v0.7.1-0.20250606181227-a3a3fb407d3b require ( code.gitea.io/sdk/gitea v0.21.0 diff --git a/go.sum b/go.sum index 0151c44d38c53..aefcdfa440159 100644 --- a/go.sum +++ b/go.sum @@ -102,8 +102,8 @@ github.com/RocketChat/Rocket.Chat.Go.SDK v0.0.0-20240116134246-a8cbe886bab0 h1:z github.com/RocketChat/Rocket.Chat.Go.SDK v0.0.0-20240116134246-a8cbe886bab0/go.mod h1:rjP7sIipbZcagro/6TCk6X0ZeFT2eyudH5+fve/cbBA= github.com/TomOnTime/utfutil v1.0.0 h1:/0Ivgo2OjXJxo8i7zgvs7ewSFZMLwCRGm3P5Umowb90= github.com/TomOnTime/utfutil v1.0.0/go.mod h1:l9lZmOniizVSuIliSkEf87qivMRlSNzbdBFKjuLRg1c= -github.com/agaudreault/gitops-engine v0.7.1-0.20250606175117-1fac77f9a2f3 h1:BLF3CmlmWulHD33fn+pp+jwkZnJWkV5Oq0K6NsMtRPE= -github.com/agaudreault/gitops-engine v0.7.1-0.20250606175117-1fac77f9a2f3/go.mod h1:duVhxDW7M7M7+19IBCVth2REOS11gmqzTWwj4u8N7aQ= +github.com/agaudreault/gitops-engine v0.7.1-0.20250606181227-a3a3fb407d3b h1:Qr0dEy2awSYsskzM7EpRF118rU0UV5WMy+9L/4X/EqI= +github.com/agaudreault/gitops-engine v0.7.1-0.20250606181227-a3a3fb407d3b/go.mod h1:duVhxDW7M7M7+19IBCVth2REOS11gmqzTWwj4u8N7aQ= github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= diff --git a/test/e2e/sync_options_test.go b/test/e2e/sync_options_test.go index 97b8abd3ad172..36a2b9e606f8a 100644 --- a/test/e2e/sync_options_test.go +++ b/test/e2e/sync_options_test.go @@ -1,6 +1,7 @@ package e2e import ( + "fmt" "os" "testing" @@ -44,7 +45,6 @@ func TestSyncWithCreateNamespace(t *testing.T) { When(). Sync(). Then(). - // Only one resource should be in sync result Expect(SyncStatusIs(SyncStatusCodeSynced)). Expect(HealthIs(health.HealthStatusHealthy)). Expect(OperationPhaseIs(OperationSucceeded)). @@ -79,11 +79,10 @@ func TestSyncWithCreateNamespaceAndDryRunError(t *testing.T) { IgnoreErrors(). Sync(). Then(). - // Only one resource should be in sync result Expect(OperationPhaseIs(OperationFailed)). Expect(ResourceResultNumbering(2)). - Expect(ResourceSyncStatusIs("Namespace", newNamespace, SyncStatusCodeSynced)). - Expect(ResourceSyncStatusWithNamespaceIs("ServiceAccount", newNamespace, "failure-during-sync", "")) + Expect(ResourceResultMatches(ResourceResult{Version: "v1", Kind: "Namespace", Name: newNamespace, Status: ResultCodeSynced, Message: fmt.Sprintf("namespace/%s created", newNamespace), HookPhase: OperationRunning, SyncPhase: SyncPhasePreSync})). + Expect(ResourceResultMatches(ResourceResult{Version: "v1", Kind: "ServiceAccount", Namespace: newNamespace, Name: "failure-during-sync", Status: ResultCodeSyncFailed, Message: `ServiceAccount "failure-during-sync" is invalid: metadata.labels: Invalid value`, HookPhase: OperationFailed, SyncPhase: SyncPhaseSync})) } // TestSyncOptionsValidateFalse verifies we can disable validation during kubectl apply, using the @@ -227,11 +226,10 @@ func TestSyncWithForceReplace(t *testing.T) { // application resources created with server side apply in the newly created namespace. func TestNamespaceCreationWithSSA(t *testing.T) { SkipOnEnv(t, "OPENSHIFT") - namespace := "guestbook-ui-with-ssa" + namespace := getNewNamespace(t) defer func() { if !t.Skipped() { - _, err := Run("", "kubectl", "delete", "namespace", namespace) - assert.NoError(t, err) + errors.NewHandler(t).FailOnErr(Run("", "kubectl", "delete", "namespace", namespace)) } }() From a65b69db4411ab1aebf182ccd3f6fd40c3765e90 Mon Sep 17 00:00:00 2001 From: Alexandre Gaudreault Date: Mon, 9 Jun 2025 18:35:03 -0400 Subject: [PATCH 6/7] fix SSA test Signed-off-by: Alexandre Gaudreault --- test/e2e/sync_options_test.go | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/test/e2e/sync_options_test.go b/test/e2e/sync_options_test.go index 36a2b9e606f8a..ddfe7d3e60f1a 100644 --- a/test/e2e/sync_options_test.go +++ b/test/e2e/sync_options_test.go @@ -233,13 +233,11 @@ func TestNamespaceCreationWithSSA(t *testing.T) { } }() - ctx := Given(t) - ctx. - SetAppNamespace(AppNamespace()). - Timeout(30). + Given(t). Path("guestbook"). When(). CreateFromFile(func(app *Application) { + app.Spec.Destination.Namespace = namespace app.Spec.SyncPolicy = &SyncPolicy{ SyncOptions: SyncOptions{"CreateNamespace=true", "ServerSideApply=true"}, } @@ -247,7 +245,6 @@ func TestNamespaceCreationWithSSA(t *testing.T) { Then(). Expect(NoNamespace(namespace)). When(). - AppSet("--dest-namespace", namespace). Sync(). Then(). Expect(Success("")). From 0bed9ecfd13a7be21b769c584d39c02f9696cf02 Mon Sep 17 00:00:00 2001 From: Alexandre Gaudreault Date: Mon, 16 Jun 2025 17:30:53 -0400 Subject: [PATCH 7/7] update mod Signed-off-by: Alexandre Gaudreault --- go.mod | 2 -- go.sum | 4 ++-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/go.mod b/go.mod index 368c08879dc24..393ac1fe03e25 100644 --- a/go.mod +++ b/go.mod @@ -2,8 +2,6 @@ module github.com/argoproj/argo-cd/v3 go 1.24.4 -replace github.com/argoproj/gitops-engine => github.com/agaudreault/gitops-engine v0.7.1-0.20250606181227-a3a3fb407d3b - require ( code.gitea.io/sdk/gitea v0.21.0 dario.cat/mergo v1.0.2 diff --git a/go.sum b/go.sum index ae07cb9994f2a..f04fe3aca392c 100644 --- a/go.sum +++ b/go.sum @@ -102,8 +102,6 @@ github.com/RocketChat/Rocket.Chat.Go.SDK v0.0.0-20240116134246-a8cbe886bab0 h1:z github.com/RocketChat/Rocket.Chat.Go.SDK v0.0.0-20240116134246-a8cbe886bab0/go.mod h1:rjP7sIipbZcagro/6TCk6X0ZeFT2eyudH5+fve/cbBA= github.com/TomOnTime/utfutil v1.0.0 h1:/0Ivgo2OjXJxo8i7zgvs7ewSFZMLwCRGm3P5Umowb90= github.com/TomOnTime/utfutil v1.0.0/go.mod h1:l9lZmOniizVSuIliSkEf87qivMRlSNzbdBFKjuLRg1c= -github.com/agaudreault/gitops-engine v0.7.1-0.20250606181227-a3a3fb407d3b h1:Qr0dEy2awSYsskzM7EpRF118rU0UV5WMy+9L/4X/EqI= -github.com/agaudreault/gitops-engine v0.7.1-0.20250606181227-a3a3fb407d3b/go.mod h1:duVhxDW7M7M7+19IBCVth2REOS11gmqzTWwj4u8N7aQ= github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= @@ -115,6 +113,8 @@ github.com/anmitsu/go-shlex v0.0.0-20200514113438-38f4b401e2be h1:9AeTilPcZAjCFI github.com/anmitsu/go-shlex v0.0.0-20200514113438-38f4b401e2be/go.mod h1:ySMOLuWl6zY27l47sB3qLNK6tF2fkHG55UZxx8oIVo4= github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY= github.com/appscode/go v0.0.0-20191119085241-0887d8ec2ecc/go.mod h1:OawnOmAL4ZX3YaPdN+8HTNwBveT1jMsqP74moa9XUbE= +github.com/argoproj/gitops-engine v0.7.1-0.20250616212358-8007df5f6c5d h1:Zv34cXFLw5S+FUiksr6N7gVVvq7qvXuxmnwE2prND+k= +github.com/argoproj/gitops-engine v0.7.1-0.20250616212358-8007df5f6c5d/go.mod h1:aIBEG3ohgaC1gh/sw2On6knkSnXkqRLDoBj234Dqczw= github.com/argoproj/notifications-engine v0.4.1-0.20250309174002-87bf0576a872 h1:ADGAdyN9ty0+RmTT/yn+xV9vwkqvLn9O1ccqeP0Zeas= github.com/argoproj/notifications-engine v0.4.1-0.20250309174002-87bf0576a872/go.mod h1:d1RazGXWvKRFv9//rg4MRRR7rbvbE7XLgTSMT5fITTE= github.com/argoproj/pkg v0.13.6 h1:36WPD9MNYECHcO1/R1pj6teYspiK7uMQLCgLGft2abM=