github.com/argoproj/argo-cd@v1.8.7/test/e2e/cli_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/pkg/apis/application/v1alpha1"
    11  	. "github.com/argoproj/argo-cd/test/e2e/fixture"
    12  	. "github.com/argoproj/argo-cd/test/e2e/fixture/app"
    13  )
    14  
    15  func TestCliAppCommand(t *testing.T) {
    16  	Given(t).
    17  		Path("hook").
    18  		When().
    19  		Create().
    20  		And(func() {
    21  			output, err := RunCli("app", "sync", Name(), "--timeout", "90")
    22  			assert.NoError(t, err)
    23  			vars := map[string]interface{}{"Name": Name(), "Namespace": DeploymentNamespace()}
    24  			assert.Contains(t, NormalizeOutput(output), Tmpl(`Pod {{.Namespace}} pod Synced Progressing pod/pod created`, vars))
    25  			assert.Contains(t, NormalizeOutput(output), Tmpl(`Pod {{.Namespace}} hook Succeeded Sync pod/hook created`, vars))
    26  		}).
    27  		Then().
    28  		Expect(OperationPhaseIs(OperationSucceeded)).
    29  		Expect(HealthIs(health.HealthStatusHealthy)).
    30  		And(func(_ *Application) {
    31  			output, err := RunCli("app", "list")
    32  			assert.NoError(t, err)
    33  			expected := Tmpl(
    34  				`{{.Name}} https://kubernetes.default.svc {{.Namespace}} default Synced Healthy <none> <none>`,
    35  				map[string]interface{}{"Name": Name(), "Namespace": DeploymentNamespace()})
    36  			assert.Contains(t, NormalizeOutput(output), expected)
    37  		})
    38  }