github.com/devdivbcp/moby@v17.12.0-ce-rc1.0.20200726071732-2d4bfdc789ad+incompatible/hack/test/e2e-run.sh (about)

     1  #!/usr/bin/env bash
     2  set -e -u -o pipefail
     3  
     4  ARCH=$(uname -m)
     5  if [ "$ARCH" = "x86_64" ]; then
     6    ARCH="amd64"
     7  fi
     8  
     9  export DOCKER_ENGINE_GOARCH=${DOCKER_ENGINE_GOARCH:-${ARCH}}
    10  
    11  # Set defaults
    12  : ${TESTFLAGS:=}
    13  : ${TESTDEBUG:=}
    14  
    15  integration_api_dirs=${TEST_INTEGRATION_DIR:-"$(
    16  	find /tests/integration -type d |
    17  	grep -vE '(^/tests/integration($|/internal)|/testdata)')"}
    18  
    19  run_test_integration() {
    20  	set_platform_timeout
    21  	run_test_integration_suites
    22  	run_test_integration_legacy_suites
    23  }
    24  
    25  run_test_integration_suites() {
    26  	local flags="-test.v -test.timeout=${TIMEOUT:-10m} $TESTFLAGS"
    27  	for dir in $integration_api_dirs; do
    28  		if ! (
    29  			cd $dir
    30  			echo "Running $PWD"
    31  			test_env ./test.main $flags
    32  		); then exit 1; fi
    33  	done
    34  }
    35  
    36  run_test_integration_legacy_suites() {
    37  	(
    38  		flags="-test.v -test.timeout=360m $TESTFLAGS"
    39  		cd /tests/integration-cli
    40  		echo "Running $PWD"
    41  		test_env ./test.main $flags
    42  	)
    43  }
    44  
    45  # use "env -i" to tightly control the environment variables that bleed into the tests
    46  test_env() {
    47  	(
    48  		set -e +u
    49  		[ -n "$TESTDEBUG" ] && set -x
    50  		env -i \
    51  			DOCKER_API_VERSION="$DOCKER_API_VERSION" \
    52  			DOCKER_INTEGRATION_DAEMON_DEST="$DOCKER_INTEGRATION_DAEMON_DEST" \
    53  			DOCKER_TLS_VERIFY="$DOCKER_TEST_TLS_VERIFY" \
    54  			DOCKER_CERT_PATH="$DOCKER_TEST_CERT_PATH" \
    55  			DOCKER_ENGINE_GOARCH="$DOCKER_ENGINE_GOARCH" \
    56  			DOCKER_GRAPHDRIVER="$DOCKER_GRAPHDRIVER" \
    57  			DOCKER_USERLANDPROXY="$DOCKER_USERLANDPROXY" \
    58  			DOCKER_HOST="$DOCKER_HOST" \
    59  			DOCKER_REMAP_ROOT="$DOCKER_REMAP_ROOT" \
    60  			DOCKER_REMOTE_DAEMON="$DOCKER_REMOTE_DAEMON" \
    61  			DOCKERFILE="$DOCKERFILE" \
    62  			GOPATH="$GOPATH" \
    63  			GOTRACEBACK=all \
    64  			HOME="$ABS_DEST/fake-HOME" \
    65  			PATH="$PATH" \
    66  			TEMP="$TEMP" \
    67  			TEST_CLIENT_BINARY="$TEST_CLIENT_BINARY" \
    68  			"$@"
    69  	)
    70  }
    71  
    72  set_platform_timeout() {
    73  	# Test timeout.
    74  	if [ "${DOCKER_ENGINE_GOARCH}" = "arm64" ] || [ "${DOCKER_ENGINE_GOARCH}" = "arm" ]; then
    75  		: ${TIMEOUT:=10m}
    76  	elif [ "${DOCKER_ENGINE_GOARCH}" = "windows" ]; then
    77  		: ${TIMEOUT:=8m}
    78  	else
    79  		: ${TIMEOUT:=5m}
    80  	fi
    81  }
    82  
    83  sh /scripts/ensure-emptyfs.sh
    84  run_test_integration