-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathrun-tests.sh
executable file
·48 lines (39 loc) · 1.23 KB
/
run-tests.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
#!/bin/bash
#including libs
. demo-util-lib.sh
. test-cases-lib.sh
export HZ_VERSION=5.0-SNAPSHOT
export TEST_CASES=all
export PACK_JARS=true
export PRINT_USAGE=false
#parsing command line arguments
while getopts t:hp: flag; do
case "${flag}" in
t) TEST_CASES=${OPTARG} ;;
h) PRINT_USAGE='true' ;;
p) PACK_JARS=${OPTARG} ;;
esac
done
#just print usage help and exit if -h option is passed
if ${PRINT_USAGE}; then
print_usage_help_exit
fi
echo "Staring automated testing of platform demos"
#exort demo root to simplify navigation
cd ..
declare -r DEMO_ROOT=$(pwd)
#pack the whole project if packaging is not disabled (-p option)
if ${PACK_JARS}; then
echo "Packaging all demo projects"
cd ${DEMO_ROOT}
mvn clean package -U -B -DskipTests=true
echo "All artifacts have been successfully built"
fi
#running tests for specified project (each test is identified by project name)
#test case is initiated by calling TEST_${project_name} function
#each test case function takes $DEMO_ROOT as a 1-st parameter and (optionally) $HZ_VERSION as a second one
IFS=',' read -ra TCS <<<"$TEST_CASES"
for project_name in "${TCS[@]}"; do
# calling test case functions from test-cases-lib.sh
TEST_${project_name} $DEMO_ROOT $HZ_VERSION
done