diff --git a/scripts/bootstrap.sh b/scripts/bootstrap.sh index 69eda2db04e..a39172b9ab6 100755 --- a/scripts/bootstrap.sh +++ b/scripts/bootstrap.sh @@ -36,7 +36,7 @@ dockerPull() { three_digit_image_tag=$1 shift #two_digit_image_tag is derived, e.g. "1.4", especially useful as a local tag for two digit references to most recent baseos, ccenv, javaenv, nodeenv patch releases - two_digit_image_tag=$(echo $three_digit_image_tag | cut -d'.' -f1,2) + two_digit_image_tag=$(echo "$three_digit_image_tag" | cut -d'.' -f1,2) while [[ $# -gt 0 ]] do image_name="$1" diff --git a/scripts/run-integration-tests.sh b/scripts/run-integration-tests.sh index d44ea69e3d1..75a8db1f7db 100755 --- a/scripts/run-integration-tests.sh +++ b/scripts/run-integration-tests.sh @@ -11,24 +11,23 @@ set -eu fabric_dir="$(cd "$(dirname "$0")/.." && pwd)" -cd ${fabric_dir} +cd "$fabric_dir" declare -a test_dirs -test_dirs=($( - go list -f '{{if or (len .TestGoFiles | ne 0) (len .XTestGoFiles | ne 0)}}{{println .Dir}}{{end}}' ./... | \ - grep integration | \ - sed "s,${fabric_dir},.,g" -)) +while IFS='' read -r line; do test_dirs+=("$line"); done < <( + go list -f '{{ if or (len .TestGoFiles | ne 0) (len .XTestGoFiles | ne 0) }}{{ println .Dir }}{{ end }}' ./... | \ + grep integration | \ + sed s,"${fabric_dir}",.,g +) total_agents=${SYSTEM_TOTALJOBSINPHASE:-1} # standard VSTS variables available using parallel execution; total number of parallel jobs running agent_number=${SYSTEM_JOBPOSITIONINPHASE:-1} # current job position declare -a dirs -test_count=${#test_dirs[@]} -for ((i = "$agent_number"; i <= "$test_count"; )); do +for ((i = "$agent_number"; i <= "${#test_dirs[@]}"; )); do dirs+=("${test_dirs[$i - 1]}") - i=$((${i} + ${total_agents})) + i=$((i + total_agents)) done -printf "\nRunning the following test suites:\n\n$(echo ${dirs[*]} | tr -s ' ' '\n')\n\nStarting tests...\n\n" -ginkgo -keepGoing --slowSpecThreshold 60 ${dirs[*]} +printf "\nRunning the following test suites:\n\n%s\n\nStarting tests...\n\n" "$(echo "${dirs[@]}" | tr -s ' ' '\n')" +ginkgo -keepGoing --slowSpecThreshold 60 "${dirs[@]}"