-
Notifications
You must be signed in to change notification settings - Fork 3
/
regress_cassandra.sh
306 lines (214 loc) · 7.07 KB
/
regress_cassandra.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
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
#!/bin/bash
#
#------------------------------
#
# Import settings
#
# Git branch
. ./settings.sh
# WriteLog() function
. ./timestampLogger.sh
#
#------------------------------
#
# Constants
#
TEST_ROOT=~/test
TEST_HOME=${TEST_ROOT}/HPCC-Platform/testing/regress
BUILD_HOME=~/build/CE/platform/build
LONG_DATE=$(date "+%Y-%m-%d_%H-%M-%S")
REGRESS_LOG_FILE=${BUILD_HOME}/regress-${LONG_DATE}.log
#
#----------------------------------------------------
#
# Start Regression Test process
#
WriteLog "Regression test started" "${REGRESS_LOG_FILE}"
#
#----------------------------------------------------
#
# Check MySQL server state
#
WriteLog "Check MySQL server state" "${REGRESS_LOG_FILE}"
#./checkMySQL.sh
#
#----------------------------------------------------
#
# Check Cassandra state
#
WriteLog "Check Cassandra state" "${REGRESS_LOG_FILE}"
./checkCassandra.sh
exit
#
#----------------------------------------------------
#
# Check Memcached state
#
WriteLog "Check Memcached state" "${REGRESS_LOG_FILE}"
./checkMemcached.sh
#
#----------------------------------------------------
#
# Clean-up, git repo clone and git submodule
#
WriteLog "Clean system" "${REGRESS_LOG_FILE}"
[ ! -e $TEST_ROOT ] && mkdir -p $TEST_ROOT
rm -rf ${TEST_ROOT}/*
cd ${TEST_ROOT}
rpm -qa | grep hpcc | grep -v grep | \
while read hpcc_package
do
rpm -e $hpcc_package
done
rm -rf clean.failed
rpm -qa | grep -v grep | grep hpcc > /dev/null 2>&1
if [ $? -eq 0 ]
then
touch clean.failed
exit
fi
#backup sys log files
[ ! -e /root/HPCCSystems-regression/syslog ] && mkdir -p /root/HPCCSysytems-regression/syslog
/bin/cp -rf /var/log/HPCCSystems/*/*.* /root/HPCCSystems-regression/syslog/
# Post uninstall
rm -rf /var/*/HPCCSystems/*
rm -rf /*/HPCCSystems
userdel hpcc
rm -rf /Users/hpcc
rm -rf /tmp/remote_install
rm -rf /home/hpcc
#----------------------------------------------------
#
# Install HPCC
#
WriteLog "Install HPCC-Platform" "${REGRESS_LOG_FILE}"
rpm -i --nodeps ${BUILD_HOME}/hpccsystems-platform?community*.rpm > install.log 2>&1
if [ $? -ne 0 ]
then
echo "TestResult:FAILED" >> install.summary
WriteLog "Install HPCC-Platform FAILED" "${REGRESS_LOG_FILE}"
exit
else
echo "TestResult:PASSED" >> install.summary
WriteLog "Install HPCC-Platform PASSED" "${REGRESS_LOG_FILE}"
fi
service hpcc-init start
#----------------------------------------------------
#
# Get test from github
#
WriteLog "Get test from github" "${REGRESS_LOG_FILE}"
git clone https://github.com/hpcc-systems/HPCC-Platform.git
cd HPCC-Platform
git submodule update --init
#
#----------------------------------------------------
#
# We use branch which is set in settings.sh
#
WriteLog "git checkout "$BRANCH_ID "${REGRESS_LOG_FILE}"
echo "git checkout "$BRANCH_ID >> ../build/git_2days.log
res=$( git checkout ${BRANCH_ID} 2>&1 )
WriteLog "result:"${res} "${REGRESS_LOG_FILE}"
echo $res >> ../build/git_2days.log
#
#-----------------------------------------------------
#
# Use roxie debug version of environment.xml
#
WriteLog "Use roxie debug version of environment.xml" "${REGRESS_LOG_FILE}"
cp /root/build/bin/environment.xml.roxie.debug /etc/HPCCSystems/environment.xml
#
#-----------------------------------------------------
#
# Prepare regression test
#
cd ..
WriteLog "Prepare reqgression test" "${REGRESS_LOG_FILE}"
logDir=/root/HPCCSystems-regression/log
[ ! -d $logDir ] && mkdir -p $logDir
rm -rf ${logDir}/*
libDir=/var/lib/HPCCSystems/regression
[ ! -d $libDir ] && mkdir -p $libDir
rm -rf ${libDir}/*
#
#-----------------------------------------------------
#
# Run test
#
WriteLog "Run regression test" "${REGRESS_LOG_FILE}"
cd $TEST_HOME
# ----------------------------------------------------
#
# From ecl-test v0.15 the 'setup' removed from clusters and it becomes separated sub command (See: HPCC-11071)
#
# Setup should run on all clusters
WriteLog "Setup phase" "${REGRESS_LOG_FILE}"
echo -n "TestResult:" > ${TEST_ROOT}/setup.summary
./ecl-test list | grep -v "Cluster" |
while read cluster
do
echo ""
echo "./ecl-test setup --target $cluster"
WriteLog "./ecl-test setup --target $cluster" "${REGRESS_LOG_FILE}"
./ecl-test setup --target $cluster
#cp ${logDir}/thor.*.log ${TEST_ROOT}/
cp ${logDir}/setup_${cluster}*.log ${TEST_ROOT}/
total=$(cat ${logDir}/setup_${cluster}.*.log | sed -n "s/^[[:space:]]*Queries:[[:space:]]*\([0-9]*\)[[:space:]]*$/\1/p")
passed=$(cat ${logDir}/setup_${cluster}.*.log | sed -n "s/^[[:space:]]*Passing:[[:space:]]*\([0-9]*\)[[:space:]]*$/\1/p")
failed=$(cat ${logDir}/setup_${cluster}.*.log | sed -n "s/^[[:space:]]*Failure:[[:space:]]*\([0-9]*\)[[:space:]]*$/\1/p")
#[ $passed -gt 0 ] && passed="<span style=\"color:#298A08\">$passed</span>"
#[ $failed -gt 0 ] && failed="<span style=\"color:#FF0000\">$passed</span>"
grep -i passed ${TEST_ROOT}/setup.summary
[ $? -eq 0 ] && echo -n "," >> ${TEST_ROOT}/setup.summary
echo -n "${cluster}:total:${total} passed:${passed} failed:${failed}" >> ${TEST_ROOT}/setup.summary
WriteLog "${cluster}:total:${total} passed:${passed} failed:${failed}" "${REGRESS_LOG_FILE}"
done
# -----------------------------------------------------
#
# Run regression suite on all clusters
#
WriteLog "Regression Suite phase" "${REGRESS_LOG_FILE}"
./ecl-test list | grep -v "Cluster" |
while read cluster
do
echo ""
# echo "./ecl-test --loglevel debug run --target $cluster"
# ./ecl-test --loglevel debug run --target $cluster
WriteLog "./ecl-test run --target $cluster" "${REGRESS_LOG_FILE}"
echo "./ecl-test run --target $cluster"
./ecl-test run --target $cluster
cp ${logDir}/${cluster}*.log ${TEST_ROOT}/
total=$(cat ${logDir}/${cluster}*.log | sed -n "s/^[[:space:]]*Queries:[[:space:]]*\([0-9]*\)[[:space:]]*$/\1/p")
passed=$(cat ${logDir}/${cluster}*.log | sed -n "s/^[[:space:]]*Passing:[[:space:]]*\([0-9]*\)[[:space:]]*$/\1/p")
failed=$(cat ${logDir}/${cluster}*.log | sed -n "s/^[[:space:]]*Failure:[[:space:]]*\([0-9]*\)[[:space:]]*$/\1/p")
#[ $passed -gt 0 ] && passed="<span style=\"color:#298A08\">$passed</span>"
#[ $failed -gt 0 ] && failed="<span style=\"color:#FF0000\">$passed</span>"
echo "TestResult:Total:${total} passed:$passed failed:$failed" > ${TEST_ROOT}/${cluster}.summary
WriteLog "TestResult:Total:${total} passed:$passed failed:$failed" "${REGRESS_LOG_FILE}"
done
# -----------------------------------------------------
#
# Uninstall HPCC
#
WriteLog "Uninstall HPCC-Platform" "${REGRESS_LOG_FILE}"
cd $TEST_ROOT
uninstallFailed=FALSE
hpccPackageName=$(rpm -qa | grep hpcc)
rpm -e $hpccPackageName > uninstall.log 2>&1
[ $? -ne 0 ] && uninstallFailed=TRUE
rpm -qa | grep hpcc > /dev/null 2>&1
[ $? -eq 0 ] && uninstallFailed=TRUE
if [ "$uninstallFailed" = "TRUE" ]
then
echo "TestResult:FAILED" >> uninstall.summary
WriteLog "Uninstall HPCC-Platform FAILED" "${REGRESS_LOG_FILE}"
else
echo "TestResult:PASSED" >> uninstall.summary
WriteLog "Uninstall HPCC-Platform PASSED" "${REGRESS_LOG_FILE}"
fi
#-----------------------------------------------------------------------------
#
# End of Regression test
#
WriteLog "End of Regression test" "${REGRESS_LOG_FILE}"