This repository was archived by the owner on Jun 23, 2022. It is now read-only.
forked from apache/bigtop
-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathrun_itest.sh
More file actions
executable file
·298 lines (258 loc) · 10.4 KB
/
run_itest.sh
File metadata and controls
executable file
·298 lines (258 loc) · 10.4 KB
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
#!/bin/bash
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
## Borrowed heavily from
## https://github.com/jctanner/odp-scripts/blob/master/run_itest.sh
## Kudos to https://github.com/jctanner
# https://github.com/apache/bigtop/tree/master/bigtop-test-framework
# "ITEST" is an integration testing framework written for and by the
# apache bigtop project. It consists of typical java tools/libraries
# such as junit, gradle and maven.
# This script is a helper to run itest on any hadoop system without
# requiring intimate knowledge of bigtop. If running for the first
# time, simply execute ./run_itest.sh without any arguments. If you
# want more information, use these additional parameters:
#
# --info - turns on the log4j output
# --debug - turns up the log4j output to maximum
# --traceback - shows tracebacks from tests
usage ()
{
echo "Usage : $0 [-options]"
echo
echo " -j, --hivejdbc hive jdbc url - default: e.g. jdbc:hive2://localhost:10000"
echo " -m, --hivemeta hive metastore url - default: thrift://localhost:9083"
echo " -l, --hivelocation location of hdfs for hive to write to - default: /user/<current user>"
echo " -u, --hiveuser hive user - default: current user"
echo " -p, --hivepassword hive user password - default: current user"
echo " -t, --hivethrift optional: true/false to test thrift, defaults to true"
echo " -c, --hivecatalog optional: true/false to test HCatalog, default to true"
echo " -C, --hiveconf hive conf dir - default: /etc/hive/conf"
echo " -F, --hadoopconf hadoop user - default: /etc/hadoop/conf"
echo " -i, --info optional: info/debug"
echo " -h, --help display this help and exit"
echo
exit
}
while [ "$1" != "" ]; do
case $1 in
-j | --hivejdbc ) shift
HIVE_JDBC_URL=$1
;;
-m | --hivemeta ) shift
HIVE_METASTORE_URL=$1
;;
-l | --hivelocation ) shift
HIVE_HDFS_LOCATION=$1
;;
-u | --hiveuser ) shift
HIVE_USER=$1
;;
-p | --hivepassword ) shift
HIVE_PASSWORD=$1
;;
-t | --hivethrift ) shift
TEST_THRIFT=$1
;;
-c | --hivecatalog ) shift
TEST_HCATALOG=$1
;;
-C | --hiveconf ) shift
HIVE_CONF_DIR=$1
;;
-F | --hadoopconf ) shift
HADOOP_CONF_DIR=$1
;;
-i | --info ) shift
LOGGING=$1
;;
-h | --help )
usage # Call your function
exit 0
;;
esac
shift
done
if [ ! -f /etc/hive/conf/hive-site.xml ]; then
echo -e "\n**** Could not find hive site configuration file, please specify hive params! ****\n"
usage
fi
if [ -z "$HIVE_JDBC_URL" ]; then
HIVE_PORT=`sed -n '/hive.server2.thrift.port/{n;p}' /etc/hive/conf/hive-site.xml | sed -n 's:.*<value>\(.*\)</value>.*:\1:p'`
netstat -nltp | grep $HIVE_PORT > /dev/null 2>&1
if [ $? -eq 0 ]; then
HIVE_JDBC_URL=jdbc:hive2://localhost:$HIVE_PORT
else
echo -e "\n**** Could not find hive server 2 service, please specify --hivejdbc argument. ****\n"
usage
fi
fi
if [ -z "$HIVE_METASTORE_URL" ]; then
HIVE_METASTORE_URL=`sed -n '/hive.metastore.uris/{n;p}' /etc/hive/conf/hive-site.xml | sed -n 's:.*<value>\(.*\)</value>.*:\1:p'`
fi
if [ -z "$HIVE_HDFS_LOCATION" ]; then
HIVE_HDFS_LOCATION=/tmp/`id -u -n`
fi
if [ -z "$HIVE_USER" ]; then
HIVE_USER=`id -u -n`
fi
if [ -z "$HIVE_PASSWORD" ]; then
HIVE_PASSWORD=`id -u -n`
fi
if [ -z "$HIVE_CONF_DIR" ]; then
export HIVE_CONF_DIR=/etc/hive/conf
fi
if [ -z "$HADOOP_CONF_DIR" ]; then
export HADOOP_CONF_DIR=/etc/hadoop/conf
fi
if [ -z "$TEST_THRIFT" ]; then
TEST_THRIFT=true
fi
if [ -z "$TEST_HCATALOG" ]; then
TEST_HCATALOG=true
fi
if [ "$LOGGING" == "info" ]; then
LOGGING="--info --stacktrace"
elif [ "$LOGGING" == "debug" ]; then
LOGGING="--debug --stacktrace"
else
LOGGING=""
fi
export DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
set_java_home() {
#####################################################################
# Use bigtop's bigtop-detect-javahome if JAVA_HOME is not already set
#####################################################################
if [ -z "$JAVA_HOME" ]; then
source $DIR/bigtop-packages/src/common/bigtop-utils/bigtop-detect-javahome
fi
}
set_hadoop_vars() {
#####################################################################
# Set the HADOOP_MAPRED_HOME and HADOOP_CONF vars
#####################################################################
# ITEST wants the MR dir with the examples jar ...
# java.lang.AssertionError: Can't find hadoop-examples.jar file
if ( [ -z "$HADOOP_HOME" ] && [ -d /usr/lib/hadoop ] ); then
export HADOOP_HOME=/usr/lib/hadoop
fi
if ( [ -z "$HADOOP_CONF_DIR" ] && [ -d /etc/hadoop/conf ] ); then
export HADOOP_CONF_DIR=/etc/hadoop/conf
fi
if ( [ -z "$HADOOP_MAPRED_HOME" ] && [ -d /usr/lib/hadoop-mapreduce-client ] ); then
export HADOOP_MAPRED_HOME=/usr/lib/hadoop-mapreduce-client
elif ( [ -z "$HADOOP_MAPRED_HOME" ] && [ -d /usr/lib/hadoop-mapreduce ] ); then
export HADOOP_MAPRED_HOME=/usr/lib/hadoop-mapreduce
fi
if ( [ -z "$HIVE_HOME" ] && [ -d /usr/lib/hive ] ); then
export HIVE_HOME=/usr/lib/hive
fi
}
print_cluster_info() {
# ODPI-87
echo "######################################################"
echo "# CLUSTER INFORMATION #"
echo "######################################################"
which facter >/dev/null 2>&1
RC=$?
if [[ $RC == 0 ]]; then
echo "# OS: $(facter lsbdistdescription)"
echo "# ARCH: $(facter architecture)"
echo "# KERNEL: $(facter kernelrelease)"
echo "# MEMORY: $(facter memorysize)"
else
echo "# OS: $(cat /etc/issue | tr '\n' ' ')"
echo "# ARCH: $(uname -i)"
echo "# KERNEL: $(uname -a)"
echo "# MEMORY: $(head -n1 /proc/meminfo)"
fi
YARN_NODES=$(yarn node -list 2>/dev/null | egrep ^Total | sed 's/Total Nodes:/TOTAL YARN NODES: /g')
echo "# $YARN_NODES"
HADOOP_VERSION=$(hadoop version 2>/dev/null | head -n1)
echo "# HADOOP_VERSION: $HADOOP_VERSION"
echo "# HADOOP_CONF_DIR: $HADOOP_CONF_DIR"
echo "# HADOOP_MAPRED_HOME: $HADOOP_MAPRED_HOME"
echo "# BASH_VERSION: $BASH_VERSION"
echo "# SH_VERSION: $(/bin/sh -c 'echo $BASH_VERSION')"
echo "# JAVA_HOME: $JAVA_HOME"
JAVA_VERSION=$(java -version 2>&1 | head -n 1 | awk -F '"' '{print $2}')
echo "# JAVA_VERSION: $JAVA_VERSION"
if [ ! -f $JAVA_HOME/lib/tools.jar ]; then
echo -e "\n**** Could not find Java tools.jar, please set JAVA_HOME to a JDK and make sure the java devel package is installed! ****\n"
exit 1
fi
}
print_tests() {
echo "######################################################"
echo "# RESULTS #"
echo "######################################################"
pushd `pwd`
for TEST in $(echo $ITESTS | tr ',' '\n'); do
TESTDIR=$DIR/bigtop-tests/smoke-tests/$TEST/build
if [ -d $TESTDIR ]; then
cd $TESTDIR
for FILE in $(find -L reports/tests/classes -type f -name "*.html"); do
echo "## $TESTDIR/$FILE"
if [ $(which links) ]; then
links $FILE -dump
else
echo "PLEASE INSTALL LINKS: sudo yum -y install links"
fi
echo ""
done
fi
done
popd
for TEST in $SPEC_TESTS; do
TESTDIR=$DIR/bigtop-tests/spec-tests/$TEST/build
if [ -d $TESTDIR ]; then
cd $TESTDIR
for FILE in $(find -L reports/tests/classes -type f -name "*.html"); do
echo "## $TESTDIR/$FILE"
if [ $(which links) ]; then
links $FILE -dump
else
echo "PLEASE INSTALL LINKS: sudo yum -y install links"
fi
echo ""
done
fi
done
}
# SET JAVA_HOME
set_java_home
# SET HADOOP SERVICE HOMES
set_hadoop_vars
# ODPI-87
print_cluster_info
echo "######################################################"
echo "# STARTING ITEST #"
echo "######################################################"
echo "# Use --debug/--info for more details"
# SET THE DEFAULT TESTS
if [ -z "$ITESTS" ]; then
export ITESTS="hcfs,hdfs,yarn,mapreduce,hive"
fi
SPEC_TESTS="runtime"
for s in `echo $ITESTS | sed -e 's#,# #g'`; do
ALL_SMOKE_TASKS="$ALL_SMOKE_TASKS bigtop-tests:smoke-tests:$s:test"
done
for s in $SPEC_TESTS; do
ALL_SPEC_TASKS="$ALL_SPEC_TASKS bigtop-tests:spec-tests:$s:test"
done
# CALL THE GRADLE WRAPPER TO RUN THE FRAMEWORK
$DIR/gradlew -q --continue clean -Psmoke.tests $ALL_SMOKE_TASKS -Pspec.tests $ALL_SPEC_TASKS -Dodpi.test.hive.jdbc.url=$HIVE_JDBC_URL -Dodpi.test.hive.metastore.url=$HIVE_METASTORE_URL -Dodpi.test.hive.location=$HIVE_HDFS_LOCATION -Dodpi.test.hive.jdbc.user=$HIVE_USER -Dodpi.test.hive.jdbc.password=$HIVE_PASSWORD -Dodpi.test.hive.conf.dir=$HIVE_CONF_DIR -Dodpi.test.hadoop.conf.dir=$HADOOP_CONF_DIR -Dodpi.test.hive.thrift.test=$TEST_THRIFT -Dodpi.test.hive.hcatalog.test=$TEST_HCATALOG $LOGGING
# SHOW RESULTS (HTML)
print_tests