github.com/argoproj/argo-cd/v2@v2.10.5/test/e2e/cluster_objects_test.go (about) 1 package e2e 2 3 import ( 4 "testing" 5 6 "github.com/argoproj/gitops-engine/pkg/health" 7 . "github.com/argoproj/gitops-engine/pkg/sync/common" 8 "github.com/stretchr/testify/assert" 9 10 . "github.com/argoproj/argo-cd/v2/pkg/apis/application/v1alpha1" 11 . "github.com/argoproj/argo-cd/v2/test/e2e/fixture" 12 . "github.com/argoproj/argo-cd/v2/test/e2e/fixture/app" 13 "github.com/argoproj/argo-cd/v2/util/argo" 14 ) 15 16 func TestClusterRoleBinding(t *testing.T) { 17 Given(t). 18 Path("cluster-role"). 19 When(). 20 CreateApp(). 21 Sync(). 22 Then(). 23 Expect(OperationPhaseIs(OperationSucceeded)). 24 Expect(HealthIs(health.HealthStatusHealthy)). 25 Expect(SyncStatusIs(SyncStatusCodeSynced)). 26 And(func(app *Application) { 27 diffOutput, err := RunCli("app", "diff", app.Name, "--revision=HEAD") 28 assert.NoError(t, err) 29 assert.Empty(t, diffOutput) 30 }). 31 When(). 32 SetTrackingMethod(string(argo.TrackingMethodAnnotation)). 33 Sync(). 34 Then(). 35 Expect(OperationPhaseIs(OperationSucceeded)). 36 Expect(SyncStatusIs(SyncStatusCodeSynced)). 37 Expect(HealthIs(health.HealthStatusHealthy)). 38 And(func(app *Application) { 39 diffOutput, err := RunCli("app", "diff", app.Name, "--revision=HEAD") 40 assert.NoError(t, err) 41 assert.Empty(t, diffOutput) 42 }) 43 } 44 45 // ensure that cluster scoped objects, like a cluster role, as a hook, can be successfully deployed 46 func TestClusterRoleBindingHook(t *testing.T) { 47 Given(t). 48 Path("cluster-role-hook"). 49 When(). 50 CreateApp(). 51 Sync(). 52 Then(). 53 Expect(OperationPhaseIs(OperationSucceeded)). 54 Expect(HealthIs(health.HealthStatusHealthy)). 55 Expect(SyncStatusIs(SyncStatusCodeSynced)) 56 }