-
Notifications
You must be signed in to change notification settings - Fork 1
/
check-missing-tests.sh
executable file
·48 lines (40 loc) · 1.18 KB
/
check-missing-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
#!/usr/bin/env bash
operator=$1
jenkinsfile=$2
cloud="openshift eks lke gke minikube"
tmp_file1=/tmp/check-missing-tests-1.log
tmp_file2=/tmp/check-missing-tests-2.log
usage() {
echo "Usage: $(basename $0) <psmdb|pxc|pgo> <full_path_to_jenkinsfile>"
echo "This script needs to be run from jenkins-pipelines/cloud/jenkins folder!"
}
extract_tests() {
local file=$1
cat ${file} | grep "runTest('" | sed "s/ //g" | sed "s/runTest('//" | sed "s/','.*')$//" | sed "s/')$//" | sort | uniq
}
if [[ $# -ne 2 ]]; then
echo "Illegal number of arguments!"
usage
exit 1
fi
if [[ ! -f ${jenkinsfile} ]]; then
echo "Jenkinsfile does't exist!"
exit 1
fi
# parse main jenkinsfile first
extract_tests ${jenkinsfile} > ${tmp_file2}
echo "###############"
# check difference for each pipeline
for c in ${cloud}; do
for f in ${operator}*_${c}*.groovy; do
echo "FILENAME: ${f}"
extract_tests ${f} > ${tmp_file1}
diff ${tmp_file1} ${tmp_file2} --side-by-side --suppress-common-lines | sed 's/\t//g' | sed 's/ //g' | sed 's/>/ > /'
if [[ ${PIPESTATUS[0]} -eq 0 ]]; then
echo " No difference!"
fi
echo "###############"
done
done
rm -f ${tmp_file1}
rm -f ${tmp_file2}