test-integration-cli 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. #!/bin/bash
  2. set -e
  3. DEST=$1
  4. DOCKER_GRAPHDRIVER=${DOCKER_GRAPHDRIVER:-vfs}
  5. DOCKER_EXECDRIVER=${DOCKER_EXECDRIVER:-native}
  6. bundle_test_integration_cli() {
  7. go_test_dir ./integration-cli
  8. }
  9. # subshell so that we can export PATH without breaking other things
  10. (
  11. export PATH="$DEST/../binary:$DEST/../dynbinary:$PATH"
  12. if ! command -v docker &> /dev/null; then
  13. echo >&2 'error: binary or dynbinary must be run before test-integration-cli'
  14. false
  15. fi
  16. # intentionally open a couple bogus file descriptors to help test that they get scrubbed in containers
  17. exec 41>&1 42>&2
  18. ( set -x; exec \
  19. docker --daemon --debug \
  20. --storage-driver "$DOCKER_GRAPHDRIVER" \
  21. --exec-driver "$DOCKER_EXECDRIVER" \
  22. --pidfile "$DEST/docker.pid" \
  23. &> "$DEST/docker.log"
  24. ) &
  25. # pull the busybox image before running the tests
  26. sleep 2
  27. source "$(dirname "$BASH_SOURCE")/.ensure-busybox"
  28. bundle_test_integration_cli
  29. DOCKERD_PID=$(set -x; cat $DEST/docker.pid)
  30. ( set -x; kill $DOCKERD_PID )
  31. wait $DOCKERD_PID || true
  32. ) 2>&1 | tee $DEST/test.log