test-integration-cli 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  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. exec > >(tee -a $DEST/test.log) 2>&1
  11. (
  12. export PATH="$DEST/../binary:$DEST/../dynbinary:$PATH"
  13. if ! command -v docker &> /dev/null; then
  14. echo >&2 'error: binary or dynbinary must be run before test-integration-cli'
  15. false
  16. fi
  17. # intentionally open a couple bogus file descriptors to help test that they get scrubbed in containers
  18. exec 41>&1 42>&2
  19. ( set -x; exec \
  20. docker --daemon --debug \
  21. --storage-driver "$DOCKER_GRAPHDRIVER" \
  22. --exec-driver "$DOCKER_EXECDRIVER" \
  23. --pidfile "$DEST/docker.pid" \
  24. &> "$DEST/docker.log"
  25. ) &
  26. # pull the busybox image before running the tests
  27. sleep 2
  28. source "$(dirname "$BASH_SOURCE")/.ensure-busybox"
  29. bundle_test_integration_cli
  30. DOCKERD_PID=$(set -x; cat $DEST/docker.pid)
  31. ( set -x; kill $DOCKERD_PID )
  32. wait $DOCKERD_PID || true
  33. )