argo-cd/test/e2e/delarative_test.go
Chetan Banavikalmutt 9476ab5e18
feat: add first class support to access repositories using proxy (#5581) (#6286)
* feat: add first class support to access repositories using proxy

Currently, users need to set the proxy URLs as env variables in the repo server. This is not user-friendly and also error-prone. This PR adds support to maintain proxy URLs along with repository configs in the argocd-cm. Argo CD uses this proxy to access your repository. In case the custom proxy is absent, it defaults to reading the proxy from the env variables.

Signed-off-by: Chetan Banavikalmutt <chetanrns1997@gmail.com>

* set both http & https proxy variables

Signed-off-by: Chetan Banavikalmutt <chetanrns1997@gmail.com>
2021-06-16 14:45:10 +02:00

80 lines
2.1 KiB
Go

package e2e
import (
"testing"
"github.com/argoproj/gitops-engine/pkg/health"
. "github.com/argoproj/gitops-engine/pkg/sync/common"
. "github.com/argoproj/argo-cd/v2/pkg/apis/application/v1alpha1"
. "github.com/argoproj/argo-cd/v2/test/e2e/fixture/app"
)
func TestDeclarativeHappyApp(t *testing.T) {
Given(t).
Path("guestbook").
When().
Declarative("declarative-apps/app.yaml").
Then().
Expect(Success("")).
Expect(HealthIs(health.HealthStatusMissing)).
Expect(SyncStatusIs(SyncStatusCodeOutOfSync)).
When().
Sync().
Then().
Expect(OperationPhaseIs(OperationSucceeded)).
Expect(HealthIs(health.HealthStatusHealthy)).
Expect(SyncStatusIs(SyncStatusCodeSynced))
}
func TestDeclarativeInvalidPath(t *testing.T) {
Given(t).
Path("garbage").
When().
Declarative("declarative-apps/app.yaml").
Then().
Expect(Success("")).
Expect(HealthIs(health.HealthStatusHealthy)).
Expect(SyncStatusIs(SyncStatusCodeUnknown)).
Expect(Condition(ApplicationConditionComparisonError, "garbage: app path does not exist")).
When().
Delete(false).
Then().
Expect(Success("")).
Expect(DoesNotExist())
}
func TestDeclarativeInvalidProject(t *testing.T) {
Given(t).
Path("guestbook").
Project("garbage").
When().
Declarative("declarative-apps/app.yaml").
Then().
Expect(Success("")).
Expect(HealthIs(health.HealthStatusUnknown)).
Expect(SyncStatusIs(SyncStatusCodeUnknown)).
Expect(Condition(ApplicationConditionInvalidSpecError, "Application referencing project garbage which does not exist")).
When().
Delete(false).
Then().
Expect(Success("")).
Expect(DoesNotExist())
}
func TestDeclarativeInvalidRepoURL(t *testing.T) {
Given(t).
Path("whatever").
When().
DeclarativeWithCustomRepo("declarative-apps/app.yaml", "https://github.com").
Then().
Expect(Success("")).
Expect(HealthIs(health.HealthStatusHealthy)).
Expect(SyncStatusIs(SyncStatusCodeUnknown)).
Expect(Condition(ApplicationConditionComparisonError, "repository not found")).
When().
Delete(false).
Then().
Expect(Success("")).
Expect(DoesNotExist())
}