e2e-run.sh 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  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. GOPATH="$GOPATH" \
  55. GOTRACEBACK=all \
  56. HOME="$ABS_DEST/fake-HOME" \
  57. PATH="$PATH" \
  58. TEMP="$TEMP" \
  59. TEST_CLIENT_BINARY="$TEST_CLIENT_BINARY" \
  60. "$@"
  61. )
  62. }
  63. set_platform_timeout() {
  64. # Test timeout.
  65. if [ "${DOCKER_ENGINE_GOARCH}" = "arm64" ] || [ "${DOCKER_ENGINE_GOARCH}" = "arm" ]; then
  66. : ${TIMEOUT:=10m}
  67. elif [ "${DOCKER_ENGINE_GOARCH}" = "windows" ]; then
  68. : ${TIMEOUT:=8m}
  69. else
  70. : ${TIMEOUT:=5m}
  71. fi
  72. }
  73. sh /scripts/build-empty-images.sh
  74. run_test_integration