forked from kubernauts/jmeter-kubernetes
-
Notifications
You must be signed in to change notification settings - Fork 0
/
start_test.sh
executable file
·31 lines (21 loc) · 901 Bytes
/
start_test.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
#!/usr/bin/env bash
#Script created to launch Jmeter tests directly from the current terminal without accessing the jmeter master pod.
#It requires that you supply the path to the jmx file
#After execution, test script jmx file may be deleted from the pod itself but not locally.
working_dir="`pwd`"
#Get namesapce variable
tenant=`awk '{print $NF}' "$working_dir/tenant_export"`
jmx="$1"
[ -n "$jmx" ] || read -p 'Enter path to the jmx file ' jmx
if [ ! -f "$jmx" ];
then
echo "Test script file was not found in PATH"
echo "Kindly check and input the correct file path"
exit
fi
test_name="$(basename "$jmx")"
#Get Master pod details
master_pod=`kubectl get po -n $tenant | grep jmeter-master | awk '{print $1}'`
kubectl cp "$jmx" -n $tenant "$master_pod:/$test_name"
## Echo Starting Jmeter load test
kubectl exec -ti -n $tenant $master_pod -- /bin/bash /load_test "$test_name"