summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xgo/t/docker/docker_deploy.sh15
-rw-r--r--go/t/docker/dockertest/deploy3
2 files changed, 15 insertions, 3 deletions
diff --git a/go/t/docker/docker_deploy.sh b/go/t/docker/docker_deploy.sh
index cd36a389..0e3f1d79 100755
--- a/go/t/docker/docker_deploy.sh
+++ b/go/t/docker/docker_deploy.sh
@@ -1,7 +1,20 @@
#!/bin/bash
cd $(dirname $(readlink -f $0))
+set -euf
rnd_port=$(shuf -i 2000-65000 -n 1)
docker_id=$(docker run -p $rnd_port:80 -d -v /krebs/go/t/docker/../../../:/krebs ubuntu /bin/bash /krebs/go/t/docker/dockertest/deploy)
#docker run -p $rnd_port:80 -v /krebs/go/t/docker/../../../:/krebs ubuntu /bin/bash /krebs/go/t/docker/dockertest/deploy
echo $docker_id on $rnd_port
-docker stop $docker_id
+trap "docker stop $docker_id" INT TERM EXIT QUIT
+i=0
+max_wait=20
+echo "waiting for install (takes about 3 minutes)"
+sleep 240
+while ! curl -s localhost:$rnd_port >/dev/null;do
+ i=$((i+1))
+ test $i -gt $max_wait && echo "timeout for installation reached, bailing out" && exit 1
+ echo "http port not yet reachable ($i of $max_wait). waiting"
+ sleep 10
+done
+short_uri=$(curl -F "uri=aids.balls" localhost:$rnd_port)
+curl $short_uri -v | grep location: | grep aids.balls
diff --git a/go/t/docker/dockertest/deploy b/go/t/docker/dockertest/deploy
index a4072ebb..355e667b 100644
--- a/go/t/docker/dockertest/deploy
+++ b/go/t/docker/dockertest/deploy
@@ -5,5 +5,4 @@ apt-get -y install redis-server nodejs npm
npm config set registry http://registry.npmjs.org/
cd /krebs/go
npm install
-HOSTN=go PORT=80 URI_PREFIX=http://go node .
-
+node .