forked from ome/devspace
-
Notifications
You must be signed in to change notification settings - Fork 1
/
runtest.sh
executable file
·63 lines (51 loc) · 1.71 KB
/
runtest.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#!/bin/bash
set -e -u -x
# start docker container
docker-compose -f docker-compose.yml up -d
# inspect containers
service_containers=( devspace_pg_1 devspace_redis_1 )
selenium_containers=( devspace_seleniumhub_1 devspace_seleniumfirefox_1 devspace_seleniumchrome_1 )
omero_containers=( devspace_omero_1 devspace_web_1 devspace_nginx_1 devspace_testintegration_1 )
jenkins_containers=( devspace_jenkins_1 devspace_nginxjenkins_1 )
all_containers=( "${service_containers[@]}" "${selenium_containers[@]}" "${omero_containers[@]}" "${jenkins_containers[@]}")
for cname in "${all_containers[@]}"
do
:
docker inspect -f {{.State.Running}} $cname
done
# check if Jenkins is fully up and running
d=10
while ! docker logs devspace_jenkins_1 2>&1 | grep "Jenkins is fully up and running"
do sleep 10
d=$[$d -1]
if [ $d -lt 0 ]; then
docker logs devspace_jenkins_1
exit 1
fi
done
# check if devspace_slaves_1 is running and connected to jenkins
for cname in "${omero_containers[@]}"
do
:
SLAVE_ADDR=`docker inspect --format '{{ .NetworkSettings.IPAddress }}' $cname`
echo "Checking $cname $SLAVE_ADDR is connected to jenkins"
d=10
while ! docker logs devspace_jenkins_1 2>&1 | grep "from /${SLAVE_ADDR}"
do sleep 10
d=$[$d -1]
if [ $d -lt 0 ]; then
docker logs devspace_jenkins_1
docker logs $cname
exit 1
fi
done
done
JENKINS_PORT=$(docker-compose port nginxjenkins 443 | cut -d: -f2)
curl -k -I https://localhost:$JENKINS_PORT
STATUS=$(curl -k --write-out %{http_code} --silent --output /dev/null https://localhost:$JENKINS_PORT)
if [ ! "200" == "$STATUS" ]; then
exit 1
fi
# CLEANUP
docker-compose -f docker-compose.yml stop
docker-compose -f docker-compose.yml rm -f