summaryrefslogtreecommitdiffstats
path: root/go
diff options
context:
space:
mode:
authorroot <root@cband>2014-01-07 05:33:47 -0600
committerroot <root@cband>2014-01-07 05:33:47 -0600
commit81b9c69fd4d989ccce4165997431c41c813e5344 (patch)
treec26c1ae7ea74fedd429c20ff7894c392546e8d66 /go
parent515736f4300cc0e535e0632cd0094b49a835d053 (diff)
go: add unfinished docker test"
Diffstat (limited to 'go')
-rw-r--r--go/Makefile24
-rwxr-xr-xgo/t/docker/docker_deploy.sh7
-rw-r--r--go/t/docker/dockertest/deploy9
3 files changed, 40 insertions, 0 deletions
diff --git a/go/Makefile b/go/Makefile
index 34d21caa..abbaf7fe 100644
--- a/go/Makefile
+++ b/go/Makefile
@@ -9,3 +9,27 @@ install: \
@! test -e $@ || { echo file already exists: $@; exit 23; }
mkdir -p $(dir $@)
cp $< $@
+
+test:
+ @export PATH="$(CURDIR)/bin:$(PATH)"; \
+ tests="`find t -type f -executable`"; \
+ i=1; \
+ pids="";\
+ n=`echo "$$tests" | wc -l`; \
+ echo $$i..$$n; \
+ for exe in $$tests; do \
+ { \
+ ./$$exe; \
+ ret=$$?; \
+ case $$ret in 0) result=ok;; *) result='not ok';; esac; \
+ echo $$result $$i - $$exe; \
+ exit $$ret;\
+ } & \
+ pids="$${pids} $$!" \
+ i=$$(( i+1 )); \
+ done; \
+ ret=0;\
+ for pid in $$pids; do \
+ wait $$pid || ret=23;\
+ done; \
+ exit $$ret;
diff --git a/go/t/docker/docker_deploy.sh b/go/t/docker/docker_deploy.sh
new file mode 100755
index 00000000..cd36a389
--- /dev/null
+++ b/go/t/docker/docker_deploy.sh
@@ -0,0 +1,7 @@
+#!/bin/bash
+cd $(dirname $(readlink -f $0))
+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
diff --git a/go/t/docker/dockertest/deploy b/go/t/docker/dockertest/deploy
new file mode 100644
index 00000000..a4072ebb
--- /dev/null
+++ b/go/t/docker/dockertest/deploy
@@ -0,0 +1,9 @@
+#!/bin/sh
+echo "deb http://archive.ubuntu.com/ubuntu precise main universe" > /etc/apt/sources.list
+apt-get update
+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 .
+