diff --git a/Makefile b/Makefile index 4c119188105b9..5bb7f9957a9d6 100644 --- a/Makefile +++ b/Makefile @@ -128,7 +128,7 @@ endef # define exec-in-test-server - $(SUDO) docker exec -it -u $(CONTAINER_UID):$(CONTAINER_GID) -e ARGOCD_E2E_RECORD=$(ARGOCD_E2E_RECORD) -e ARGOCD_E2E_K3S=$(ARGOCD_E2E_K3S) argocd-test-server $(1) + $(SUDO) docker exec -it -u $(CONTAINER_UID):$(CONTAINER_GID) -e ARGOCD_E2E_RECORD=$(ARGOCD_E2E_RECORD) -e TEST_FLAGS="$(TEST_FLAGS)" -e ARGOCD_E2E_K3S=$(ARGOCD_E2E_K3S) argocd-test-server $(1) endef PATH:=$(PATH):$(PWD)/hack @@ -413,10 +413,10 @@ test-e2e: # Run the E2E test suite (local version) .PHONY: test-e2e-local -test-e2e-local: cli-local +test-e2e-local: # NO_PROXY ensures all tests don't go out through a proxy if one is configured on the test system export GO111MODULE=off - ARGOCD_E2E_RECORD=${ARGOCD_E2E_RECORD} ARGOCD_GPG_ENABLED=true NO_PROXY=* ./hack/test.sh -timeout $(ARGOCD_E2E_TEST_TIMEOUT) -v ./test/e2e + TEST_FLAGS="${TEST_FLAGS}" ARGOCD_E2E_RECORD=${ARGOCD_E2E_RECORD} ARGOCD_GPG_ENABLED=true NO_PROXY=* ./hack/test.sh -timeout $(ARGOCD_E2E_TEST_TIMEOUT) -v ./test/e2e # Spawns a shell in the test server container for debugging purposes debug-test-server: test-tools-image diff --git a/docs/developer-guide/test-e2e.md b/docs/developer-guide/test-e2e.md index 477723016bd75..c694f20535839 100644 --- a/docs/developer-guide/test-e2e.md +++ b/docs/developer-guide/test-e2e.md @@ -13,6 +13,10 @@ Git repository via file url: `file:///tmp/argocd-e2e***`. You can observe the tests by using the UI [http://localhost:8080/applications](http://localhost:8080/applications) with username `"admin"` and password `"password"`. +### Running Single E2E Test + +The `test-e2e` target passes the `TEST_FLAGS` environment variable to the `go test` run inside the local ArgoCD server container. To run a single e2e test, pass this argument on execution `TEST_FLAGS="-test.run ^TestCustomToolWithEnv\$$" make test-e2e`. Dollar signs need to be escaped with a double dollar for the `Makefile` forwarding the execution to the underlying container. + ## Configuration of E2E Tests execution The Makefile's `start-e2e` target starts instances of ArgoCD on your local machine, of which the most will require a network listener. If for whatever reason you already have network services on your machine listening on the same ports, the e2e tests will not be able to run. You can derive from the defaults by setting the following environment variables before you run `make start-e2e`: diff --git a/hack/test.sh b/hack/test.sh index 6eacb0a358722..23a9cdbe9a4bd 100755 --- a/hack/test.sh +++ b/hack/test.sh @@ -4,7 +4,7 @@ set -eux -o pipefail which go-junit-report || go install github.com/jstemmer/go-junit-report@latest TEST_RESULTS=${TEST_RESULTS:-test-results} -TEST_FLAGS= +TEST_FLAGS=${TEST_FLAGS:-} if test "${ARGOCD_TEST_PARALLELISM:-}" != ""; then TEST_FLAGS="$TEST_FLAGS -p $ARGOCD_TEST_PARALLELISM"