-
Notifications
You must be signed in to change notification settings - Fork 0
/
run_test.sh
61 lines (49 loc) · 1.38 KB
/
run_test.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
#!/usr/bin/env bash
cd test
echo "===> Changing directory to \"./test\""
docker-compose up -d --build --force-recreate cassandra kafka mongo
function ping_cassandra() {
docker exec -it cassandra /usr/bin/nodetool status | grep UN
res=$?
}
echo "Waiting for Cassandra to be ready."
# For some reason, GoCql still can't connect to Cassandra even if the nodetool
# shows positive results. There has to be a better way than this.
max_attempts=40
cur_attempts=0
ping_cassandra
while (( res != 0 && ++cur_attempts != max_attempts ))
do
ping_cassandra
echo Attempt: $cur_attempts of $max_attempts
sleep 1
done
if (( cur_attempts == max_attempts )); then
echo "Cassandra Timed Out."
exit 1
else
echo "Cassandra response received."
fi
echo "Waiting additional time for Cassandra to be ready."
add_wait=30
cur_add_wait=0
while (( ++cur_add_wait != add_wait ))
do
echo Additional Wait: $cur_add_wait of $add_wait seconds
sleep 1
done
docker-compose up -d --build --force-recreate go-eventpersistence
echo "Waiting for go-eventpersistence to initialize"
sleep 5
docker-compose up -d --build --force-recreate go-eventstore-query
echo "Waiting for go-eventstore-query to initialize"
sleep 5
docker-compose up -d --build --force-recreate rmb-userauth-users
sleep 5
docker ps -a
docker-compose up --exit-code-from rmb-userauth-users-test
rc=$?
if [[ $rc != 0 ]]
docker ps -a
then exit $rc
fi