2017-08-14 15:47:06 -04:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
# Setup, run and teardown e2e test suite in containers.
|
|
|
|
set -eu -o pipefail
|
|
|
|
|
|
|
|
unique_id="${E2E_UNIQUE_ID:-cliendtoendsuite}"
|
|
|
|
e2e_env_image=docker-cli-e2e-env:$unique_id
|
|
|
|
dev_image=docker-cli-dev:$unique_id
|
|
|
|
|
|
|
|
function run_in_env {
|
|
|
|
local cmd=$1
|
|
|
|
docker run -i --rm \
|
|
|
|
-v /var/run/docker.sock:/var/run/docker.sock \
|
|
|
|
-e E2E_UNIQUE_ID \
|
|
|
|
"$e2e_env_image" "$cmd"
|
|
|
|
}
|
|
|
|
|
|
|
|
docker build \
|
|
|
|
-t "$e2e_env_image" \
|
|
|
|
-f dockerfiles/Dockerfile.test-e2e-env .
|
|
|
|
|
|
|
|
docker build \
|
|
|
|
-t "$dev_image" \
|
|
|
|
-f dockerfiles/Dockerfile.dev .
|
|
|
|
|
2017-10-06 19:11:01 -04:00
|
|
|
notary_volume="${unique_id}_notary-fixtures"
|
|
|
|
docker volume create "$notary_volume"
|
|
|
|
docker run --rm \
|
|
|
|
-v "$PWD:/go/src/github.com/docker/cli" \
|
|
|
|
-v "$notary_volume:/data" \
|
|
|
|
"$dev_image" \
|
|
|
|
cp -r ./e2e/testdata/notary/* /data/
|
|
|
|
|
2017-08-14 15:47:06 -04:00
|
|
|
engine_host=$(run_in_env setup)
|
|
|
|
testexit=0
|
|
|
|
docker run -i --rm \
|
|
|
|
-v "$PWD:/go/src/github.com/docker/cli" \
|
2017-10-06 19:11:01 -04:00
|
|
|
-v "$PWD/e2e/testdata/notary/root-ca.cert:/usr/local/share/ca-certificates/notary.cert" \
|
2017-08-14 15:47:06 -04:00
|
|
|
--network "${unique_id}_default" \
|
2017-09-01 17:52:41 -04:00
|
|
|
-e TESTFLAGS \
|
2017-08-14 15:47:06 -04:00
|
|
|
"$dev_image" \
|
|
|
|
./scripts/test/e2e/run test "$engine_host" || testexit="$?"
|
2017-10-06 19:11:01 -04:00
|
|
|
|
2017-08-14 15:47:06 -04:00
|
|
|
run_in_env cleanup
|
|
|
|
exit "$testexit"
|