summaryrefslogtreecommitdiff
path: root/hack/make/test-integration-cli
blob: b0506d261a0aaefef61a8bdcd6271ceb796b8d82 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#!/bin/bash

DEST=$1

set -e

DOCKER_GRAPHDRIVER=${DOCKER_GRAPHDRIVER:-vfs}
DOCKER_EXECDRIVER=${DOCKER_EXECDRIVER:-native}

bundle_test_integration_cli() {
	go_test_dir ./integration-cli
}

# subshell so that we can export PATH without breaking other things
(
	export PATH="$DEST/../binary:$DEST/../dynbinary:$PATH"
	
	if ! command -v docker &> /dev/null; then
		echo >&2 'error: binary or dynbinary must be run before test-integration-cli'
		false
	fi
	
	( set -x; exec \
		docker --daemon --debug \
		--storage-driver "$DOCKER_GRAPHDRIVER" \
		--exec-driver "$DOCKER_EXECDRIVER" \
		--pidfile "$DEST/docker.pid" \
			&> "$DEST/docker.log"
	) &
	
	# pull the busybox image before running the tests
	sleep 2
	( set -x; docker pull busybox )
	
	bundle_test_integration_cli
	
	DOCKERD_PID=$(set -x; cat $DEST/docker.pid)
	( set -x; kill $DOCKERD_PID )
	wait $DOCKERD_PID || true
) 2>&1 | tee $DEST/test.log