summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMaxim Biro <nurupo.contributions@gmail.com>2017-12-12 23:39:51 -0500
committerMaxim Biro <nurupo.contributions@gmail.com>2017-12-16 14:41:01 -0500
commit57115f0e751e50262705bafc998eae5f35fae9cc (patch)
treeeb54d528692e608cfd79f996a131ab4d51b54977
parent418a304c0eeea1c15103d96ab6c372aeec8f4367 (diff)
Test tox-bootstrapd Docker container on Travis
-rw-r--r--.travis.yml5
-rwxr-xr-xother/travis/tox-bootstrapd-docker-linux-script63
2 files changed, 68 insertions, 0 deletions
diff --git a/.travis.yml b/.travis.yml
index f214de39..47b16c31 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -24,6 +24,11 @@ matrix:
24 sudo: required 24 sudo: required
25 install: other/travis/phase $JOB $ENV install stage1 25 install: other/travis/phase $JOB $ENV install stage1
26 script: other/travis/phase $JOB $ENV script stage1 26 script: other/travis/phase $JOB $ENV script stage1
27 - stage: "Stage 1"
28 env: JOB=tox-bootstrapd-docker ENV=linux
29 services:
30 - docker
31 sudo: required
27 - stage: "Stage 2" 32 - stage: "Stage 2"
28 env: JOB=toxcore ENV=freebsd 33 env: JOB=toxcore ENV=freebsd
29 dist: trusty 34 dist: trusty
diff --git a/other/travis/tox-bootstrapd-docker-linux-script b/other/travis/tox-bootstrapd-docker-linux-script
new file mode 100755
index 00000000..bb3b5422
--- /dev/null
+++ b/other/travis/tox-bootstrapd-docker-linux-script
@@ -0,0 +1,63 @@
1#!/bin/sh
2
3# Copy source code to other/bootstrap_daemon/docker/c-toxcore
4OLD_PWD=$PWD
5cd /tmp
6cp -a $OLD_PWD c-toxcore
7mv c-toxcore $OLD_PWD/other/bootstrap_daemon/docker
8cd $OLD_PWD
9ls -lbh other/bootstrap_daemon/docker
10ls -lbh other/bootstrap_daemon/docker/c-toxcore
11
12cd other/bootstrap_daemon
13
14# Make Docker container use our current source code instead of master branch
15sed -i "s|WORKDIR /tmp/tox|WORKDIR /tmp/tox\nADD /c-toxcore ./c-toxcore/|g" docker/Dockerfile
16sed -i '/git clone/d' docker/Dockerfile
17
18cat docker/Dockerfile
19
20sudo docker build -t tox-bootstrapd docker/
21sudo useradd --home-dir /var/lib/tox-bootstrapd --create-home --system --shell /sbin/nologin --comment "Account to run Tox's DHT bootstrap daemon" --user-group tox-bootstrapd
22sudo chmod 700 /var/lib/tox-bootstrapd
23sudo docker run -d --name tox-bootstrapd -v /var/lib/tox-bootstrapd/:/var/lib/tox-bootstrapd/ -p 443:443 -p 3389:3389 -p 33445:33445 -p 33445:33445/udp tox-bootstrapd
24
25sudo ls -lbh /var/lib/tox-bootstrapd
26
27if sudo [ ! -f /var/lib/tox-bootstrapd/keys ]; then
28 echo "Error: File /var/lib/tox-bootstrapd/keys doesn't exist"
29 exit 1
30fi
31
32COUNTER=0
33COUNTER_END=120
34while [ $COUNTER -lt $COUNTER_END ]; do
35 if sudo docker logs tox-bootstrapd | grep -q "Connected to another bootstrap node successfully" ; then
36 break
37 fi
38 sleep 1
39 COUNTER=$(($COUNTER+1))
40done
41
42sudo docker logs tox-bootstrapd
43
44if [ "$COUNTER" = "$COUNTER_END" ]; then
45 echo "Error: Didn't connect to any nodes"
46 exit 1
47fi
48
49# Wait a bit befrore testing if the container is still running
50sleep 30
51
52sudo docker ps -a
53
54if [ "`sudo docker inspect -f {{.State.Running}} tox-bootstrapd`" != "true" ]; then
55 echo "Error: Container is not running"
56 exit 1
57fi
58
59if ! python3 ../fun/bootstrap_node_info.py ipv4 localhost 33445 ; then
60 echo "Error: Unable to get bootstrap node info"
61 exit 1
62fi
63