@@ -17,25 +17,26 @@ if [[ "${TESTFLAGS}" = *-test.run* ]]; then
1717fi
1818
1919
20- if [ -z ${MAKEDIR} ]; then
21- export MAKEDIR=" $( cd " $( dirname " ${BASH_SOURCE[0]} " ) " && pwd ) "
20+ if [ -z " ${MAKEDIR} " ]; then
21+ MAKEDIR=" $( cd " $( dirname " ${BASH_SOURCE[0]} " ) " && pwd ) "
22+ export MAKEDIR
2223fi
23- source " $MAKEDIR /.go-autogen"
24+ source " ${ MAKEDIR} /.go-autogen"
2425
2526# Set defaults
26- : ${TEST_REPEAT:= 1}
27- : ${TESTFLAGS:= }
28- : ${TESTDEBUG:= }
27+ : " ${TEST_REPEAT:= 1} "
28+ : " ${TESTFLAGS:= } "
29+ : " ${TESTDEBUG:= } "
2930
3031setup_integration_test_filter () {
3132 if [ -z " ${TEST_FILTER} " ]; then
3233 return
3334 fi
3435
3536 if [ -z " ${TEST_SKIP_INTEGRATION} " ]; then
36- : ${TEST_INTEGRATION_DIR:= $(grep -rl " func\ .*${TEST_FILTER} .*\(t\ \*testing\.T\)" ./ integration | grep ' _test\.go' | xargs -I file dirname file | uniq)}
37+ : " ${TEST_INTEGRATION_DIR:= $(grep -rl " func\ .*${TEST_FILTER} .*\(t\ \*testing\.T\)" ./ integration | grep ' _test\.go' | xargs -I file dirname file | uniq)} "
3738 if [ -z " ${TEST_INTEGRATION_DIR} " ]; then
38- echo Skipping integration tests since the supplied filter \" ${TEST_FILTER} \" omits all integration tests
39+ echo " Skipping integration tests since the supplied filter \" ${TEST_FILTER} \" omits all integration tests"
3940 TEST_SKIP_INTEGRATION=1
4041 else
4142 TESTFLAGS_INTEGRATION+=" -test.run ${TEST_FILTER} "
@@ -46,15 +47,15 @@ setup_integration_test_filter() {
4647 # ease up on the filtering here since CLI suites are namespaced by an object
4748 if grep -r " ${TEST_FILTER} .*\(c\ \*check\.C\)" ./integration-cli | grep -q ' _test\.go$' ; then
4849 TEST_SKIP_INTEGRATION_CLI=1
49- echo Skipping integration-cli tests since the supplied filter \" ${TEST_FILTER} \" omits all integration-cli tests
50+ echo " Skipping integration-cli tests since the supplied filter \" ${TEST_FILTER} \" omits all integration-cli tests"
5051 else
5152 TESTFLAGS_INTEGRATION_CLI+=" -check.f ${TEST_FILTER} "
5253 fi
5354 fi
5455}
5556
5657setup_integration_test_filter
57- integration_api_dirs=${TEST_INTEGRATION_DIR:- $(go list -test -f ' {{- if ne .ForTest "" -}}{{- .Dir -}}{{- end -}}' ./ integration/ ...)}
58+ integration_api_dirs=" ${TEST_INTEGRATION_DIR:- $(go list -test -f ' {{- if ne .ForTest "" -}}{{- .Dir -}}{{- end -}}' ./ integration/ ...)} "
5859
5960run_test_integration () {
6061 set_platform_timeout
@@ -72,6 +73,7 @@ run_test_integration_suites() {
7273 if ! (
7374 cd " $dir "
7475 echo " Running $PWD flags=${flags} "
76+ # shellcheck disable=SC2086
7577 test_env ./test.main ${flags}
7678 ); then exit 1; fi
7779 done
@@ -82,12 +84,13 @@ run_test_integration_legacy_suites() {
8284 flags=" -check.v -check.timeout=${TIMEOUT} -test.timeout=360m $TESTFLAGS ${TESTFLAGS_INTEGRATION_CLI} "
8385 cd integration-cli
8486 echo " Running $PWD flags=${flags} "
87+ # shellcheck disable=SC2086
8588 test_env ./test.main $flags
8689 )
8790}
8891
8992build_test_suite_binaries () {
90- if [ ${DOCKER_INTEGRATION_TESTS_VERIFIED-} ]; then
93+ if [ -n " ${DOCKER_INTEGRATION_TESTS_VERIFIED} " ]; then
9194 echo " Skipping building test binaries; as DOCKER_INTEGRATION_TESTS_VERIFIED is set"
9295 return
9396 fi
@@ -112,6 +115,7 @@ build_test_suite_binary() {
112115cleanup_test_suite_binaries () {
113116 [ -n " $TESTDEBUG " ] && return
114117 echo " Removing test suite binaries"
118+ # shellcheck disable=SC2038
115119 find integration* -name test.main | xargs -r rm
116120}
117121
@@ -160,6 +164,7 @@ error_on_leaked_containerd_shims() {
160164 awk ' $2 == "containerd-shim" && $4 ~ /.*\/bundles\/.*\/test-integration/ { print $1 }' )
161165 if [ -n " $leftovers " ]; then
162166 ps aux
167+ # shellcheck disable=SC2086
163168 kill -9 ${leftovers} 2> /dev/null
164169 echo " !!!! WARNING you have left over shim(s), Cleanup your test !!!!"
165170 exit 1
@@ -169,11 +174,11 @@ error_on_leaked_containerd_shims() {
169174set_platform_timeout () {
170175 # Test timeout.
171176 if [ " ${DOCKER_ENGINE_GOARCH} " = " arm64" ] || [ " ${DOCKER_ENGINE_GOARCH} " = " arm" ]; then
172- : ${TIMEOUT:= 10m}
177+ : " ${TIMEOUT:= 10m} "
173178 elif [ " ${DOCKER_ENGINE_GOARCH} " = " windows" ]; then
174- : ${TIMEOUT:= 8m}
179+ : " ${TIMEOUT:= 8m} "
175180 else
176- : ${TIMEOUT:= 5m}
181+ : " ${TIMEOUT:= 5m} "
177182 fi
178183
179184 if [ " ${TEST_REPEAT} " -gt 1 ]; then
0 commit comments