github.com/hechain20/hechain@v0.0.0-20220316014945-b544036ba106/scripts/run-integration-tests.sh (about) 1 #!/bin/bash 2 # 3 # Copyright hechain. All Rights Reserved. 4 # 5 # SPDX-License-Identifier: Apache-2.0 6 7 # Use ginkgo to run integration tests. If arguments are provided to the 8 # script, they are treated as the directories containing the tests to run. 9 # When no arguments are provided, all integration tests are executed. 10 11 set -eu 12 13 fabric_dir="$(cd "$(dirname "$0")/.." && pwd)" 14 cd "$fabric_dir" 15 16 declare -a test_dirs 17 while IFS='' read -r line; do test_dirs+=("$line"); done < <( 18 go list -f '{{ if or (len .TestGoFiles | ne 0) (len .XTestGoFiles | ne 0) }}{{ println .Dir }}{{ end }}' ./... | \ 19 grep integration | \ 20 sed s,"${fabric_dir}",.,g 21 ) 22 23 total_agents=${SYSTEM_TOTALJOBSINPHASE:-1} # standard VSTS variables available using parallel execution; total number of parallel jobs running 24 agent_number=${SYSTEM_JOBPOSITIONINPHASE:-1} # current job position 25 26 declare -a dirs 27 for ((i = "$agent_number"; i <= "${#test_dirs[@]}"; )); do 28 dirs+=("${test_dirs[$i - 1]}") 29 i=$((i + total_agents)) 30 done 31 32 printf "\nRunning the following test suites:\n\n%s\n\nStarting tests...\n\n" "$(echo "${dirs[@]}" | tr -s ' ' '\n')" 33 ginkgo -keepGoing --slowSpecThreshold 60 "${dirs[@]}"