github.com/gophercloud/gophercloud@v1.11.0/script/acceptancetest (about) 1 #!/bin/bash 2 # 3 set -x 4 set -o pipefail 5 6 source `dirname $0`/stackenv 7 8 timeout="60m" 9 failed= 10 11 if [[ -z "${LOG_DIR}" ]]; then 12 echo "LOG_DIR not set, will set a temp directory" 13 LOG_DIR=/tmp/devstack-logs 14 fi 15 mkdir -p ${LOG_DIR} 16 17 if [[ -z "${ACCEPTANCE_TESTS_FILTER}" ]]; then 18 ACCEPTANCE_TESTS=$(find internal/acceptance/openstack -name '*_test.go' -exec dirname {} \; | sort -n | uniq) 19 else 20 ACCEPTANCE_TESTS=$(find internal/acceptance/openstack -name '*_test.go' -exec dirname {} \; | sort -n | uniq | grep -P "$ACCEPTANCE_TESTS_FILTER") 21 fi 22 ACCEPTANCE_TESTS=($ACCEPTANCE_TESTS) 23 24 if [[ -z $ACCEPTANCE_TESTS ]]; then 25 echo "No acceptance tests to run" 26 exit 0 27 fi 28 29 for acceptance_test in "${ACCEPTANCE_TESTS[@]}"; do 30 go test -v -timeout $timeout -tags "fixtures acceptance" ./${acceptance_test} |& tee -a ${LOG_DIR}/acceptance_tests.log 31 # Check the error code after each suite, but do not exit early if a suite failed. 32 if [[ $? != 0 ]]; then 33 failed=1 34 fi 35 done 36 37 # If any of the test suites failed, exit 1 38 if [[ -n $failed ]]; then 39 exit 1 40 fi 41 42 exit 0