-
Notifications
You must be signed in to change notification settings - Fork 59
/
start_test.sh
executable file
·44 lines (31 loc) · 1.18 KB
/
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
32
33
34
35
36
37
38
39
40
41
42
43
44
#!/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.
namespace="$1"
[ -n "$namespace" ] || read -p 'Enter the Jmeter Namespace: ' namespace
kubectl get namespace | grep $namespace >> /dev/null
if [ $? != 0 ];
then
echo "Namespace does not exist in the kubernetes cluster"
echo ""
echo "Below is the list of namespaces in the kubernetes cluster"
kubectl get namespaces
echo ""
echo "Please check and try again"
exit
fi
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 -n $namespace get po | grep jmeter-master | awk '{print $1}'`
kubectl -n $namespace cp "$jmx" "$master_pod:/$test_name"
## Echo Starting Jmeter load test
kubectl -n $namespace exec -ti $master_pod -- /bin/bash /load_test "$test_name"