diff --git a/dockertest/Makefile b/dockertest/Makefile index c166eea11aa..694e8e49126 100644 --- a/dockertest/Makefile +++ b/dockertest/Makefile @@ -1,13 +1,8 @@ RANDOMSRC = Godeps/_workspace/src/github.com/jbenet/go-random/random -IPFS_DOCKER_IMAGE = zaqwsx_ipfs-test-img +IMAGE_NAME = ipfs-test-latest test: clean setup - fig build --no-cache - fig up --no-color | tee build/fig.log - make save_logs # save the ipfs logs for inspection - # fig up won't report the error using an error code, so we grep the - # fig.log file to find out whether the call succeeded - tail build/fig.log | grep "exited with code 0" + ./run-test-on-img.sh $(IMAGE_NAME) setup: docker_ipfs_image data/filetiny data/filerand @@ -23,15 +18,11 @@ data/filerand: bin/random bin/random: go build -o ./bin/random ../$(RANDOMSRC) -docker_ipfs_image: build/.built_img - docker images | grep $(IPFS_DOCKER_IMAGE) - -# this is here so that "make clean; make" rebuilds the docker img. -# but otherwise will reuse whatever you last built. -# TODO: make this detect whether code has been changed -build/.built_img: - cd .. && docker build -t $(IPFS_DOCKER_IMAGE) . - touch build/.built_img +# just build it every time... this part isn't +# even the lengthy part, and it decreases pain. +docker_ipfs_image: + cd .. && docker build -t $(IMAGE_NAME) . + docker images | grep $(IMAGE_NAME) clean: sh bin/clean.sh @@ -41,4 +32,3 @@ clean: rm -f data/filetiny rm -f data/filerand rm -rf build/* - rm -rf build/.built_img diff --git a/dockertest/run-test-on-img.sh b/dockertest/run-test-on-img.sh new file mode 100755 index 00000000000..d53cde34b23 --- /dev/null +++ b/dockertest/run-test-on-img.sh @@ -0,0 +1,33 @@ +#!/bin/sh +if [ "$#" -ne 1 ]; then + echo "usage: $0 " + echo "runs this test on image matching " + exit 1 +fi + +# this tag is used by the dockerfiles in +# {data, server, client, bootstrap} +tag=zaqwsx_ipfs-test-img + +# could use set -v, but i dont want to see the comments... + +img=$(docker images | grep $1 | awk '{print $3}') +echo "using docker image: $img ($1)" + +echo docker tag -f $img $tag +docker tag -f $img $tag + +echo "fig build --no-cache" +fig build --no-cache + +echo "fig up --no-color | tee build/fig.log" +fig up --no-color | tee build/fig.log + +# save the ipfs logs for inspection +echo "make save_logs" +make save_logs + +# fig up won't report the error using an error code, so we grep the +# fig.log file to find out whether the call succeeded +echo 'tail build/fig.log | grep "exited with code 0"' +tail build/fig.log | grep "exited with code 0"