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)
|
|
|
|
if [ "$ARCH" == "x86_64" ]; then
|
|
|
|
ARCH="amd64"
|
|
|
|
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:-"$(
|
2018-03-14 06:21:21 -04: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() {
|
2018-02-23 09:56:03 -05:00
|
|
|
[[ "$TESTFLAGS" != *-check.f* ]] && 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
|
|
|
(
|
2018-03-27 12:13:47 -04:00
|
|
|
flags="-check.v -check.timeout=${TIMEOUT:-200m} -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
|
|
|
|
[ -n "$TESTDEBUG" ] && set -x
|
|
|
|
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
|
|
|
|
2018-03-27 12:13:47 -04:00
|
|
|
sh /scripts/ensure-emptyfs.sh
|
2017-09-14 13:17:49 -04:00
|
|
|
run_test_integration
|