-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrun_test.sh
71 lines (60 loc) · 1.55 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
62
63
64
65
66
67
68
69
70
71
#!/usr/bin/env bash
cd test
echo "===> Changing directory to \"./test\""
docker-compose up -d --build --force-recreate cassandra kafka mongo
rc=$?
if [[ $rc != 0 ]]
then exit $rc
fi
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
# The Cassandra image takes more time to be ready despite
# nodetool-status being success.
# There has to be a better way than this.
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
rc=$?
if [[ $rc != 0 ]]
then exit $rc
fi
echo "Waiting for go-eventpersistence to initialize"
sleep 10
docker-compose up -d --build --force-recreate go-eventstore-query
rc=$?
if [[ $rc != 0 ]]
then exit $rc
fi
echo "Waiting for go-eventstore-query to initialize"
sleep 10
docker ps -a
docker-compose up --exit-code-from go-agg-builder
rc=$?
docker-compose down --rmi local --volumes
exit $rc