From 369bd0f4dc6c5c30eac582d443e12f355147ca6a Mon Sep 17 00:00:00 2001 From: Matthias Radestock Date: Tue, 23 Jun 2015 14:16:52 +0100 Subject: [PATCH] prefetch test images This gives more consistent test execution times, and also make image fetch failures more apparent and decoupled from the tests. We could *always* just run pull, but it's an expensive operation, so we check for the presence of the image first. The downside is that we could be running old images. That is not a problem on our CI infrastructure though since it spins up fresh VMs per for every tun. --- test/config.sh | 2 ++ test/setup.sh | 6 +++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/test/config.sh b/test/config.sh index 2015de02..cd5d32e3 100644 --- a/test/config.sh +++ b/test/config.sh @@ -31,6 +31,8 @@ SSH=${SSH:-ssh -l vagrant -i ./insecure_private_key -o UserKnownHostsFile=./.ssh SMALL_IMAGE="gliderlabs/alpine" DNS_IMAGE="aanand/docker-dnsutils" +TEST_IMAGES="$SMALL_IMAGE $DNS_IMAGE" + PING="ping -nq -W 1 -c 1" CHECK_ETHWE_UP="grep ^1$ /sys/class/net/ethwe/carrier" diff --git a/test/setup.sh b/test/setup.sh index 3a147517..147475f4 100755 --- a/test/setup.sh +++ b/test/setup.sh @@ -6,7 +6,8 @@ set -e (cd ./tls && go get ./... && go run generate_certs.go $HOSTS) -echo Copying weave images, scripts, and certificates to hosts +echo "Copying weave images, scripts, and certificates to hosts, and" +echo " prefetch docker images" for HOST in $HOSTS; do docker_on $HOST load -i ../weave.tar docker_on $HOST load -i ../weavedns.tar @@ -16,4 +17,7 @@ for HOST in $HOSTS; do cat ../weave | run_on $HOST sh -c "cat > ./weave" run_on $HOST chmod a+x $DOCKER_NS ./weave rsync -az -e "$SSH" ./tls/ $HOST:~/tls + for IMG in $TEST_IMAGES ; do + docker_on $HOST inspect --format=" " $IMG >/dev/null 2>&1 || docker_on $HOST pull $IMG + done done