Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit 917b0dcd3df383e841b7e0e4a7f3c174959544b7)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
| ... | ... |
@@ -17,15 +17,16 @@ if [[ "${TESTFLAGS}" = *-test.run* ]]; then
|
| 17 | 17 |
fi |
| 18 | 18 |
|
| 19 | 19 |
|
| 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 |
|
| 22 | 23 |
fi |
| 23 |
-source "$MAKEDIR/.go-autogen" |
|
| 24 |
+source "${MAKEDIR}/.go-autogen"
|
|
| 24 | 25 |
|
| 25 | 26 |
# Set defaults |
| 26 |
-: ${TEST_REPEAT:=1}
|
|
| 27 |
-: ${TESTFLAGS:=}
|
|
| 28 |
-: ${TESTDEBUG:=}
|
|
| 27 |
+: "${TEST_REPEAT:=1}"
|
|
| 28 |
+: "${TESTFLAGS:=}"
|
|
| 29 |
+: "${TESTDEBUG:=}"
|
|
| 29 | 30 |
|
| 30 | 31 |
setup_integration_test_filter() {
|
| 31 | 32 |
if [ -z "${TEST_FILTER}" ]; then
|
| ... | ... |
@@ -33,9 +34,9 @@ setup_integration_test_filter() {
|
| 33 | 33 |
fi |
| 34 | 34 |
|
| 35 | 35 |
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)}
|
|
| 36 |
+ : "${TEST_INTEGRATION_DIR:=$(grep -rl "func\ .*${TEST_FILTER}.*\(t\ \*testing\.T\)" ./integration | grep '_test\.go' | xargs -I file dirname file | uniq)}"
|
|
| 37 | 37 |
if [ -z "${TEST_INTEGRATION_DIR}" ]; then
|
| 38 |
- echo Skipping integration tests since the supplied filter \"${TEST_FILTER}\" omits all integration tests
|
|
| 38 |
+ echo "Skipping integration tests since the supplied filter \"${TEST_FILTER}\" omits all integration tests"
|
|
| 39 | 39 |
TEST_SKIP_INTEGRATION=1 |
| 40 | 40 |
else |
| 41 | 41 |
TESTFLAGS_INTEGRATION+="-test.run ${TEST_FILTER}"
|
| ... | ... |
@@ -46,7 +47,7 @@ setup_integration_test_filter() {
|
| 46 | 46 |
# ease up on the filtering here since CLI suites are namespaced by an object |
| 47 | 47 |
if grep -r "${TEST_FILTER}.*\(c\ \*check\.C\)" ./integration-cli | grep -q '_test\.go$'; then
|
| 48 | 48 |
TEST_SKIP_INTEGRATION_CLI=1 |
| 49 |
- echo Skipping integration-cli tests since the supplied filter \"${TEST_FILTER}\" omits all integration-cli tests
|
|
| 49 |
+ echo "Skipping integration-cli tests since the supplied filter \"${TEST_FILTER}\" omits all integration-cli tests"
|
|
| 50 | 50 |
else |
| 51 | 51 |
TESTFLAGS_INTEGRATION_CLI+="-check.f ${TEST_FILTER}"
|
| 52 | 52 |
fi |
| ... | ... |
@@ -54,7 +55,7 @@ setup_integration_test_filter() {
|
| 54 | 54 |
} |
| 55 | 55 |
|
| 56 | 56 |
setup_integration_test_filter |
| 57 |
-integration_api_dirs=${TEST_INTEGRATION_DIR:-$(go list -test -f '{{- if ne .ForTest "" -}}{{- .Dir -}}{{- end -}}' ./integration/...)}
|
|
| 57 |
+integration_api_dirs="${TEST_INTEGRATION_DIR:-$(go list -test -f '{{- if ne .ForTest "" -}}{{- .Dir -}}{{- end -}}' ./integration/...)}"
|
|
| 58 | 58 |
|
| 59 | 59 |
run_test_integration() {
|
| 60 | 60 |
set_platform_timeout |
| ... | ... |
@@ -72,6 +73,7 @@ run_test_integration_suites() {
|
| 72 | 72 |
if ! ( |
| 73 | 73 |
cd "$dir" |
| 74 | 74 |
echo "Running $PWD flags=${flags}"
|
| 75 |
+ # shellcheck disable=SC2086 |
|
| 75 | 76 |
test_env ./test.main ${flags}
|
| 76 | 77 |
); then exit 1; fi |
| 77 | 78 |
done |
| ... | ... |
@@ -82,12 +84,13 @@ run_test_integration_legacy_suites() {
|
| 82 | 82 |
flags="-check.v -check.timeout=${TIMEOUT} -test.timeout=360m $TESTFLAGS ${TESTFLAGS_INTEGRATION_CLI}"
|
| 83 | 83 |
cd integration-cli |
| 84 | 84 |
echo "Running $PWD flags=${flags}"
|
| 85 |
+ # shellcheck disable=SC2086 |
|
| 85 | 86 |
test_env ./test.main $flags |
| 86 | 87 |
) |
| 87 | 88 |
} |
| 88 | 89 |
|
| 89 | 90 |
build_test_suite_binaries() {
|
| 90 |
- if [ ${DOCKER_INTEGRATION_TESTS_VERIFIED-} ]; then
|
|
| 91 |
+ if [ -n "${DOCKER_INTEGRATION_TESTS_VERIFIED}" ]; then
|
|
| 91 | 92 |
echo "Skipping building test binaries; as DOCKER_INTEGRATION_TESTS_VERIFIED is set" |
| 92 | 93 |
return |
| 93 | 94 |
fi |
| ... | ... |
@@ -112,6 +115,7 @@ build_test_suite_binary() {
|
| 112 | 112 |
cleanup_test_suite_binaries() {
|
| 113 | 113 |
[ -n "$TESTDEBUG" ] && return |
| 114 | 114 |
echo "Removing test suite binaries" |
| 115 |
+ # shellcheck disable=SC2038 |
|
| 115 | 116 |
find integration* -name test.main | xargs -r rm |
| 116 | 117 |
} |
| 117 | 118 |
|
| ... | ... |
@@ -160,6 +164,7 @@ error_on_leaked_containerd_shims() {
|
| 160 | 160 |
awk '$2 == "containerd-shim" && $4 ~ /.*\/bundles\/.*\/test-integration/ { print $1 }')
|
| 161 | 161 |
if [ -n "$leftovers" ]; then |
| 162 | 162 |
ps aux |
| 163 |
+ # shellcheck disable=SC2086 |
|
| 163 | 164 |
kill -9 ${leftovers} 2> /dev/null
|
| 164 | 165 |
echo "!!!! WARNING you have left over shim(s), Cleanup your test !!!!" |
| 165 | 166 |
exit 1 |
| ... | ... |
@@ -169,11 +174,11 @@ error_on_leaked_containerd_shims() {
|
| 169 | 169 |
set_platform_timeout() {
|
| 170 | 170 |
# Test timeout. |
| 171 | 171 |
if [ "${DOCKER_ENGINE_GOARCH}" = "arm64" ] || [ "${DOCKER_ENGINE_GOARCH}" = "arm" ]; then
|
| 172 |
- : ${TIMEOUT:=10m}
|
|
| 172 |
+ : "${TIMEOUT:=10m}"
|
|
| 173 | 173 |
elif [ "${DOCKER_ENGINE_GOARCH}" = "windows" ]; then
|
| 174 |
- : ${TIMEOUT:=8m}
|
|
| 174 |
+ : "${TIMEOUT:=8m}"
|
|
| 175 | 175 |
else |
| 176 |
- : ${TIMEOUT:=5m}
|
|
| 176 |
+ : "${TIMEOUT:=5m}"
|
|
| 177 | 177 |
fi |
| 178 | 178 |
|
| 179 | 179 |
if [ "${TEST_REPEAT}" -gt 1 ]; then
|