github.com/pachyderm/pachyderm@v1.13.4/etc/testing/circle/run_tests.sh (about) 1 #!/bin/bash 2 3 set -ex 4 5 # shellcheck source=./env.sh 6 source "$(dirname "$0")/env.sh" 7 8 VM_IP="$(minikube ip)" 9 export VM_IP 10 11 PACH_PORT="30650" 12 export PACH_PORT 13 14 POSTGRES_SERVICE_HOST="$(minikube ip)" 15 export POSTGRES_SERVICE_HOST 16 17 POSTGRES_SERVICE_PORT=32228 18 export POSTGRES_SERVICE_PORT 19 20 TESTFLAGS="-v | stdbuf -i0 tee -a /tmp/results" 21 export TESTFLAGS 22 23 # make launch-kube connects with kubernetes, so it should just be available 24 minikube status 25 kubectl version 26 27 eval "$(minikube docker-env)" 28 29 echo "Running test suite based on BUCKET=$BUCKET" 30 31 function test_bucket { 32 set +x 33 package="${1}" 34 target="${2}" 35 bucket_num="${3}" 36 num_buckets="${4}" 37 if (( bucket_num == 0 )); then 38 echo "Error: bucket_num should be > 0, but was 0" >/dev/stderr 39 exit 1 40 fi 41 42 echo "Running bucket $bucket_num of $num_buckets" 43 # shellcheck disable=SC2207 44 tests=( $(go test -v "${package}" -list ".*" | grep -v '^ok' | grep -v '^Benchmark') ) 45 # Add anchors for the regex so we don't run collateral tests 46 tests=( "${tests[@]/#/^}" ) 47 tests=( "${tests[@]/%/\$\$}" ) 48 total_tests="${#tests[@]}" 49 # Determine the offset and length of the sub-array of tests we want to run 50 # The last bucket may have a few extra tests, to accommodate rounding 51 # errors from bucketing: 52 let "bucket_size=total_tests/num_buckets" \ 53 "start=bucket_size * (bucket_num-1)" \ 54 "bucket_size+=bucket_num < num_buckets ? 0 : total_tests%num_buckets" 55 test_regex="$(IFS=\|; echo "${tests[*]:start:bucket_size}")" 56 echo "Running ${bucket_size} tests of ${total_tests} total tests" 57 make RUN="-run='${test_regex}'" "${target}" 58 set -x 59 } 60 61 62 # Clean cached test results 63 go clean -testcache 64 65 case "${BUCKET}" in 66 MISC) 67 make lint 68 make enterprise-code-checkin-test 69 make test-cmds 70 make test-libs 71 make test-proto-static 72 make test-transaction 73 make test-deploy-manifests 74 make test-s3gateway-unit 75 make test-enterprise 76 make test-worker 77 if [[ "$TRAVIS_SECURE_ENV_VARS" == "true" ]]; then 78 # these tests require secure env vars to run, which aren't available 79 # when the PR is coming from an outside contributor - so we just 80 # disable them 81 make test-tls 82 make test-vault 83 fi 84 ;; 85 ADMIN) 86 make test-admin 87 ;; 88 EXAMPLES) 89 echo "Running the example test suite" 90 ./etc/testing/examples.sh 91 ;; 92 PFS) 93 make test-pfs-server 94 make test-pfs-storage 95 ;; 96 PPS?) 97 pushd etc/testing/images/ubuntu_with_s3_clients 98 make push-to-minikube 99 popd 100 make docker-build-kafka 101 bucket_num="${BUCKET#PPS}" 102 test_bucket "./src/server" test-pps "${bucket_num}" "${PPS_BUCKETS}" 103 if [[ "${bucket_num}" -eq "${PPS_BUCKETS}" ]]; then 104 go test -v -count=1 ./src/server/pps/server -timeout 3600s 105 fi 106 ;; 107 AUTH?) 108 make launch-dex 109 bucket_num="${BUCKET#AUTH}" 110 test_bucket "./src/server/auth/server/testing" test-auth "${bucket_num}" "${AUTH_BUCKETS}" 111 set +x 112 ;; 113 OBJECT) 114 make test-object-clients 115 ;; 116 *) 117 echo "Unknown bucket" 118 exit 1 119 ;; 120 esac