forked from argoproj/argo-cd
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(appcontroller): Uptake fix in gitops engine which fixes applicati…
…on sync with auto create ns and server side apply (argoproj#16942) * Uptake fix in gitops engine to fix auto create ns with server side apply Signed-off-by: anandf <[email protected]> * Moved the new e2e test to different location Signed-off-by: anandf <[email protected]> * Fix test name to be less than 63 char for creating ns Signed-off-by: anandf <[email protected]> * update gitops-engine with latest master Signed-off-by: Leonardo Luz Almeida <[email protected]> --------- Signed-off-by: anandf <[email protected]> Signed-off-by: Leonardo Luz Almeida <[email protected]> Co-authored-by: Leonardo Luz Almeida <[email protected]>
- Loading branch information
Showing
3 changed files
with
64 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
package e2e | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/argoproj/gitops-engine/pkg/health" | ||
. "github.com/argoproj/gitops-engine/pkg/sync/common" | ||
"github.com/stretchr/testify/assert" | ||
v1 "k8s.io/api/core/v1" | ||
|
||
. "github.com/argoproj/argo-cd/v2/pkg/apis/application/v1alpha1" | ||
. "github.com/argoproj/argo-cd/v2/test/e2e/fixture" | ||
. "github.com/argoproj/argo-cd/v2/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(app *Application, ns *v1.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)) | ||
} |