github.com/argoproj/argo-cd@v1.8.7/hack/test.sh (about)

     1  #!/bin/bash
     2  set -eux -o pipefail
     3  
     4  # make sure apiclient does not depend on packr
     5  which godepgraph || go get github.com/kisielk/godepgraph
     6  which go-junit-report || go get github.com/jstemmer/go-junit-report
     7  
     8  export GO111MODULE=off
     9  if godepgraph -s github.com/argoproj/argo-cd/pkg/apiclient | grep packr; then
    10    echo apiclient package should not depend on packr
    11    exit 1
    12  fi
    13  unset GO111MODULE
    14  
    15  TEST_RESULTS=${TEST_RESULTS:-test-results}
    16  TEST_FLAGS=
    17  
    18  if test "${ARGOCD_TEST_PARALLELISM:-}" != ""; then
    19  	TEST_FLAGS="$TEST_FLAGS -p $ARGOCD_TEST_PARALLELISM"
    20  fi
    21  if test "${ARGOCD_TEST_VERBOSE:-}" != ""; then
    22  	TEST_FLAGS="$TEST_FLAGS -v"
    23  fi
    24  
    25  mkdir -p $TEST_RESULTS
    26  
    27  report() {
    28    set -eux -o pipefail
    29  
    30    go-junit-report < $TEST_RESULTS/test.out > $TEST_RESULTS/junit.xml
    31  }
    32  
    33  trap 'report' EXIT
    34  
    35  go test $TEST_FLAGS -failfast $* 2>&1 | tee $TEST_RESULTS/test.out