Skip to content

Commit

Permalink
TestSyncWithImpersonateFail test
Browse files Browse the repository at this point in the history
Signed-off-by: Mangaal <angommeeteimangaal@gmail.com>
  • Loading branch information
Mangaal committed Apr 11, 2024
1 parent d1774f4 commit 85a2c02
Showing 1 changed file with 48 additions and 0 deletions.
48 changes: 48 additions & 0 deletions test/e2e/sync_with_impersonate_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
package e2e

import (
"context"
"testing"

"github.com/argoproj/argo-cd/v2/pkg/apis/application/v1alpha1"
. "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"
"github.com/stretchr/testify/assert"

//corev1 "k8s.io/api/core/v1"
//rbac "k8s.io/api/rbac/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)

func TestSyncWithImpersonateFail(t *testing.T) {
projectName := "test-project-without-rbac"
_, err := fixture.AppClientset.ArgoprojV1alpha1().AppProjects(fixture.TestNamespace()).Create(context.Background(),
&AppProject{
ObjectMeta: metav1.ObjectMeta{
Name: projectName,
Namespace: fixture.TestNamespace(),
},
Spec: AppProjectSpec{
SourceRepos: []string{"*"},
Destinations: []v1alpha1.ApplicationDestination{{Namespace: "*", Server: "*"}},
SourceNamespaces: []string{"*"},
},
},
metav1.CreateOptions{})

assert.NoError(t, err)

Given(t).
Path("guestbook").
When().
SetParamInSettingConfigMap("application.sync.impersonation.enabled", "true").
CreateFromFile(func(app *Application) {
app.Spec.Project = projectName
app.Spec.SyncPolicy = &SyncPolicy{Automated: &SyncPolicyAutomated{}}
}).
Sync().
Then().
Expect(SyncStatusIs(SyncStatusCodeOutOfSync))

}

0 comments on commit 85a2c02

Please sign in to comment.