argoproj/argo-cd
Testing
Argo CD has three complementary test surfaces. Pick the one that matches what you are changing.
Unit tests
Go unit tests sit alongside the production code under each package as *_test.go. They are extensive — most production files have a test file of similar or larger size (e.g., controller/state.go is 54 KB while controller/state_test.go is 83 KB).
Run all unit tests:
make test
# or directly:
go test ./...Run a single package or test:
go test ./server/application/...
go test ./controller -run TestSyncOperationFailsMocks
Mock interfaces are generated with mockery. The configuration lives at .mockery.yaml in the repo root. After editing an interface that is mocked elsewhere, regenerate mocks:
make mocksExisting mocks live under mocks/ subdirectories (e.g., applicationset/services/scm_provider/mocks/, util/git/mocks/).
End-to-end tests
The test/e2e/ tree exercises the full stack against a running Kubernetes cluster (commonly k3d or kind). The harness in test/fixture/ brings up the controllers and seeds them with test fixtures.
make test-e2eEnvironment variables that gate parts of the e2e suite are documented in test/fixture/test/fixture.go and the CI workflow .github/workflows/ci-build.yaml. Common ones:
ARGOCD_E2E_APISERVER_PORT,ARGOCD_E2E_REPOSERVER_PORT,ARGOCD_E2E_REDIS_PORT,ARGOCD_E2E_DEX_PORT— port assignments.ARGOCD_FAKE_IN_CLUSTER=true— used by all components for in-cluster mode without a real serviceaccount token.ARGOCD_E2E_DISABLE_AUTH=true— bypass login during e2e tests.ARGOCD_E2E_RERUN_FAILS— flake retry budget.
Pre-baked test repos (Helm charts, plain-YAML, OCI registries) live under test/fixture/testrepos/ and are served by test/fixture/testrepos/start-git.sh, start-helm-registry.sh, and start-authenticated-helm-registry.sh — wired into the Procfile as git-server, helm-registry, and oci-registry.
UI tests
The UI has Jest unit tests configured by ui/jest.config.js and ui/jest.setup.js. Run them with pnpm test inside ui/. There is also a Playwright/Cypress-style suite under ui-test/.
Test utilities
test/testutil.goandtest/testdata.go— common test helpers and fixtures.util/test/— Go test helpers shared across packages.controller/testdata/,server/.../testdata/— golden-file fixtures (manifests, JSON snapshots).
Race detector and -norace files
A few tests are intentionally not race-safe and live in *_norace_test.go files (e.g., server/server_norace_test.go, util/rbac/rbac_norace_test.go). They are excluded from -race runs in CI.
Coverage
The Makefile writes coverage to the directory pointed at by ARGOCD_COVERAGE_DIR for goreman-launched components, and Codecov is configured via .codecov.yml. Coverage is uploaded by the CI workflow.
For day-to-day work prefer running the focused package tests; the full make test is what CI runs and what reviewers expect to be green.
Built by Factory AutoWiki from public repository content. It is a generated preview for codebase exploration, not source-maintained documentation.