2017-09-08 10:43:04 -04:00
|
|
|
#!/usr/bin/env bash
|
2018-02-23 09:56:03 -05:00
|
|
|
set -e -u -o pipefail
|
2017-09-08 10:43:04 -04:00
|
|
|
|
2018-02-23 09:56:03 -05:00
|
|
|
ARCH=$(uname -m)
|
2019-07-17 01:05:35 -04:00
|
|
|
if [ "$ARCH" = "x86_64" ]; then
|
2020-03-02 22:27:49 -05:00
|
|
|
ARCH="amd64"
|
2018-02-23 09:56:03 -05:00
|
|
|
fi
|
2017-09-14 13:17:49 -04:00
|
|
|
|
2018-02-23 09:56:03 -05:00
|
|
|
export DOCKER_ENGINE_GOARCH=${DOCKER_ENGINE_GOARCH:-${ARCH}}
|
2017-09-14 13:17:49 -04:00
|
|
|
|
2018-02-23 09:56:03 -05:00
|
|
|
# Set defaults
|
|
|
|
: ${TESTFLAGS:=}
|
|
|
|
: ${TESTDEBUG:=}
|
|
|
|
|
|
|
|
integration_api_dirs=${TEST_INTEGRATION_DIR:-"$(
|
2020-03-02 22:27:49 -05:00
|
|
|
find /tests/integration -type d \
|
|
|
|
| grep -vE '(^/tests/integration($|/internal)|/testdata)'
|
|
|
|
)"}
|
2017-09-12 08:53:20 -04:00
|
|
|
|
2017-09-14 13:17:49 -04:00
|
|
|
run_test_integration() {
|
2019-07-17 01:05:35 -04:00
|
|
|
set_platform_timeout
|
2019-08-26 14:15:30 -04:00
|
|
|
run_test_integration_suites
|
|
|
|
run_test_integration_legacy_suites
|
2017-09-14 13:17:49 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
run_test_integration_suites() {
|
2018-03-27 12:13:47 -04:00
|
|
|
local flags="-test.v -test.timeout=${TIMEOUT:-10m} $TESTFLAGS"
|
2018-02-23 09:56:03 -05:00
|
|
|
for dir in $integration_api_dirs; do
|
|
|
|
if ! (
|
|
|
|
cd $dir
|
|
|
|
echo "Running $PWD"
|
|
|
|
test_env ./test.main $flags
|
|
|
|
); then exit 1; fi
|
|
|
|
done
|
2017-09-14 13:17:49 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
run_test_integration_legacy_suites() {
|
2018-02-23 09:56:03 -05:00
|
|
|
(
|
2019-08-30 17:07:17 -04:00
|
|
|
flags="-test.v -test.timeout=360m $TESTFLAGS"
|
2018-03-14 06:21:21 -04:00
|
|
|
cd /tests/integration-cli
|
2018-02-23 09:56:03 -05:00
|
|
|
echo "Running $PWD"
|
|
|
|
test_env ./test.main $flags
|
|
|
|
)
|
2017-09-14 13:17:49 -04:00
|
|
|
}
|
2017-09-08 10:43:04 -04:00
|
|
|
|
2018-02-23 09:56:03 -05:00
|
|
|
# use "env -i" to tightly control the environment variables that bleed into the tests
|
|
|
|
test_env() {
|
|
|
|
(
|
|
|
|
set -e +u
|
2019-01-09 20:23:38 -05:00
|
|
|
[ -n "$TESTDEBUG" ] && set -x
|
2018-02-23 09:56:03 -05:00
|
|
|
env -i \
|
|
|
|
DOCKER_API_VERSION="$DOCKER_API_VERSION" \
|
|
|
|
DOCKER_INTEGRATION_DAEMON_DEST="$DOCKER_INTEGRATION_DAEMON_DEST" \
|
|
|
|
DOCKER_TLS_VERIFY="$DOCKER_TEST_TLS_VERIFY" \
|
|
|
|
DOCKER_CERT_PATH="$DOCKER_TEST_CERT_PATH" \
|
|
|
|
DOCKER_ENGINE_GOARCH="$DOCKER_ENGINE_GOARCH" \
|
|
|
|
DOCKER_GRAPHDRIVER="$DOCKER_GRAPHDRIVER" \
|
|
|
|
DOCKER_USERLANDPROXY="$DOCKER_USERLANDPROXY" \
|
|
|
|
DOCKER_HOST="$DOCKER_HOST" \
|
|
|
|
DOCKER_REMAP_ROOT="$DOCKER_REMAP_ROOT" \
|
|
|
|
DOCKER_REMOTE_DAEMON="$DOCKER_REMOTE_DAEMON" \
|
|
|
|
DOCKERFILE="$DOCKERFILE" \
|
|
|
|
GOPATH="$GOPATH" \
|
|
|
|
GOTRACEBACK=all \
|
|
|
|
HOME="$ABS_DEST/fake-HOME" \
|
|
|
|
PATH="$PATH" \
|
|
|
|
TEMP="$TEMP" \
|
|
|
|
TEST_CLIENT_BINARY="$TEST_CLIENT_BINARY" \
|
|
|
|
"$@"
|
|
|
|
)
|
|
|
|
}
|
2017-09-08 10:43:04 -04:00
|
|
|
|
2019-07-17 01:05:35 -04:00
|
|
|
set_platform_timeout() {
|
|
|
|
# Test timeout.
|
|
|
|
if [ "${DOCKER_ENGINE_GOARCH}" = "arm64" ] || [ "${DOCKER_ENGINE_GOARCH}" = "arm" ]; then
|
|
|
|
: ${TIMEOUT:=10m}
|
|
|
|
elif [ "${DOCKER_ENGINE_GOARCH}" = "windows" ]; then
|
|
|
|
: ${TIMEOUT:=8m}
|
|
|
|
else
|
|
|
|
: ${TIMEOUT:=5m}
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2018-03-27 12:13:47 -04:00
|
|
|
sh /scripts/ensure-emptyfs.sh
|
2017-09-14 13:17:49 -04:00
|
|
|
run_test_integration
|