e2e-run.sh 2.0 KB

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