github.com/argoproj/argo-cd/v3@v3.2.1/hack/test.sh (about) 1 #!/bin/bash 2 set -eux -o pipefail 3 4 # check for local installation of go-junit-report otherwise install locally 5 which go-junit-report || go install github.com/jstemmer/go-junit-report@latest 6 7 # check for local installation of gotestsum otherwise install locally 8 which gotestsum || go install gotest.tools/gotestsum@latest 9 10 TEST_RESULTS=${TEST_RESULTS:-test-results} 11 TEST_FLAGS=${TEST_FLAGS:-} 12 13 if test "${ARGOCD_TEST_PARALLELISM:-}" != ""; then 14 TEST_FLAGS="$TEST_FLAGS -p $ARGOCD_TEST_PARALLELISM" 15 fi 16 if test "${ARGOCD_TEST_VERBOSE:-}" != ""; then 17 TEST_FLAGS="$TEST_FLAGS -v" 18 fi 19 20 mkdir -p "$TEST_RESULTS" 21 22 # `TEST_FLAGS` cannot be quoted as empty needs to evaluate to 0 arguments. 23 # `TEST_FLAGS` cannot be turned into array without backward incompatible change of script input 24 # shellcheck disable=SC2086 25 GODEBUG="tarinsecurepath=0,zipinsecurepath=0" \ 26 gotestsum --rerun-fails-report=rerunreport.txt --junitfile="$TEST_RESULTS/junit.xml" --format=testname \ 27 --rerun-fails="$RERUN_FAILS" --packages="$PACKAGES" -- -cover $TEST_FLAGS "$@"