-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathexecute_test.sh
More file actions
executable file
·98 lines (74 loc) · 3.22 KB
/
Copy pathexecute_test.sh
File metadata and controls
executable file
·98 lines (74 loc) · 3.22 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
#!/usr/bin/env bash
# jmeter_bin_address='/jmeter/apache-jmeter-5.0/bin'
framework_base_location_pods='/'
working_dir=`pwd`
# The all the config variables
source ./perf-load-gen.cfg
echo "###################################################################"
echo "###################################################################"
echo
echo "Sujeet's Distributed Performance Testing Platform"
echo
echo "###################################################################"
echo "###################################################################"
echo
echo
read -p 'Enter path to the root of the Performance testing framework : ' frameworkPath
echo
read -p 'Enter the Main test file name (.jmx for JMeter || .yml for Taurus) : ' masterTestFile
echo
read -p 'Enter Rewrite existing framework Y/N : ' rewriteFrameworkFlag
echo
if [ ! -d "${frameworkPath}" ];
then
echo "Framework was not found in the provided PATH"
echo "Kindly check and input the correct framework path"
exit
fi
if ! [ "${rewriteFrameworkFlag}" == "Y" -o "${rewriteFrameworkFlag}" == "N" ]
then
echo "Wrong input! please enter valid input for Rewrite existing framework Y/N"
echo
exit
fi
#Get Master pod details
master_pod=`kubectl get po -n ${thenamespace} | grep jmeter-master | awk '{print $1}'`
worker_pods=`kubectl get po -n ${thenamespace} | grep jmeter-worker | awk '{print $1}'`
echo "Test will be executed from : "
frameworkFolder=$(basename ${frameworkPath})
echo "${master_pod}:/${framework_base_location_pods}${frameworkFolder}"
echo
echo "Worker pods in use for the test: "
echo ${worker_pods}
echo
echo "Checking if test framework is already available in the pod"
echo
frameworkFolderExists=`kubectl exec -it -n ${thenamespace} ${master_pod} -- /bin/bash -c "if [ -d '/${framework_base_location_pods}${frameworkFolder}' ]; \
then echo 'TRUE'; else echo 'FALSE'; fi"`
echo "Framework Folder Exists: " ${frameworkFolderExists}
echo "Rewrite Flag: " ${rewriteFrameworkFlag}
echo
if [[ "${frameworkFolderExists}" == *FALSE* || "${rewriteFrameworkFlag}" == "Y" ]]
then
kubectl cp ${frameworkPath} -n ${thenamespace} ${master_pod}:${framework_base_location_pods}
echo 'Framework copied to Master Pod: ' ${master_pod}
echo
for eachPod in ${worker_pods}; do
kubectl cp ${frameworkPath} -n ${thenamespace} ${eachPod}:${framework_base_location_pods}; echo "Framework copied to Worker Pod: " ${eachPod}; echo;
done
fi
echo
echo "Checking if load_test runner is available"
kubectl exec -it -n ${thenamespace} ${master_pod} -- /bin/sh -c \
"if [ ! -f '/jmeter/load_test' ]; then echo 'Move load_test file to jmeter directory and change permissions'; \
cp -r /load_test /jmeter/load_test; \
chmod 755 /jmeter/load_test; \
else echo 'File present Changing the permissions'; \
chmod 755 /jmeter/load_test; fi"
echo
## Echo Starting Jmeter load test
echo "###################################################################"
echo "Starting Performance Tests"
echo "###################################################################"
echo
kubectl exec -it -n ${thenamespace} ${master_pod} -- /jmeter/load_test ${framework_base_location_pods}${frameworkFolder}/${masterTestFile}