forked from Netflix/dynomite
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtravis.sh
executable file
·132 lines (111 loc) · 3.17 KB
/
travis.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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
#!/bin/bash
if [ -n "$TRAVIS" ]; then
#python libs
sudo pip install redis
sudo pip install git+https://github.com/andymccurdy/[email protected]
fi
# parse options
rebuild=true
debug=false
while [ "$#" -gt 0 ]; do
arg=$1
case $1 in
-n|--no-rebuild) shift; rebuild=false;;
-d|--debug) shift; debug=true;;
-*) usage_fatal "unknown option: '$1'";;
*) break;; # reached the list of file names
esac
done
#build Dynomite
if [[ "${rebuild}" == "true" ]]; then
CFLAGS="-ggdb3 -O0" autoreconf -fvi && ./configure --enable-debug=log && make
else
echo "not rebuilding Dynomite"
fi
# Create the environment
rm -rf test/_binaries/
mkdir test/_binaries
rm -rf test/logs
mkdir test/logs
rm test/conf
ln -s ../conf test/conf
cp `pwd`/src/dynomite test/_binaries/
cp `which redis-server` test/_binaries/
cp `which redis-cli` test/_binaries/
cd test
# launch processes
function launch_redis() {
./_binaries/redis-server --port 1212 > ./logs/redis_standalone.log &
./_binaries/redis-server --port 22121 > ./logs/redis_22121.log &
./_binaries/redis-server --port 22122 > ./logs/redis_22122.log &
./_binaries/redis-server --port 22123 > ./logs/redis_22123.log &
./_binaries/redis-server --port 22124 > ./logs/redis_22124.log &
./_binaries/redis-server --port 22125 > ./logs/redis_22125.log &
}
function launch_dynomite() {
./_binaries/dynomite -d -o ./logs/a_dc1.log \
-c ./conf/a_dc1.yml -v6
./_binaries/dynomite -d -o ./logs/a_dc2_rack1_node1.log \
-c ./conf/a_dc2_rack1_node1.yml -v6
./_binaries/dynomite -d -o ./logs/a_dc2_rack1_node2.log \
-c ./conf/a_dc2_rack1_node2.yml -v6
./_binaries/dynomite -d -o ./logs/a_dc2_rack2_node1.log \
-c ./conf/a_dc2_rack2_node1.yml -v6
./_binaries/dynomite -d -o ./logs/a_dc2_rack2_node2.log \
-c ./conf/a_dc2_rack2_node2.yml -v6
}
function kill_redis() {
killall redis-server
}
function kill_dynomite() {
killall dynomite
}
declare -i RESULT
RESULT=0
function cleanup_and_exit() {
kill_redis
kill_dynomite
exit $RESULT
}
launch_redis
launch_dynomite
DYNOMITE_NODES=`pgrep dynomite | wc -l`
REDIS_NODES=`pgrep redis-server | wc -l`
if [[ $DYNOMITE_NODES -ne 5 ]]; then
echo "Not all dynomite nodes are running" >&2
RESULT=1
cleanup_and_exit
fi
if [[ $REDIS_NODES -ne 6 ]]; then
echo "Not all redis nodes are running" >&2
RESULT=1
cleanup_and_exit
fi
echo "Cluster Deployed....."
sleep 10
if [[ "${debug}" == "true" ]]; then
./func_test.py --debug
else
sh -c ./func_test.py
fi
RESULT=$?
echo $RESULT
# check a single stats port
curl -s localhost:22222/info | python -mjson.tool > /dev/null
if [[ $? -ne 0 ]]; then
echo "Stats are not working or not valid json" >&2
RESULT=1
fi
DYNOMITE_NODES=`pgrep dynomite | wc -l`
REDIS_NODES=`pgrep redis-server | wc -l`
if [[ $DYNOMITE_NODES -ne 5 ]]; then
echo "Not all dynomite nodes are running" >&2
RESULT=1
cleanup_and_exit
fi
if [[ $REDIS_NODES -ne 6 ]]; then
echo "Not all redis nodes are running" >&2
RESULT=1
cleanup_and_exit
fi
cleanup_and_exit