From 6268284f43058fdb23f2f3101129db40fee8bb8a Mon Sep 17 00:00:00 2001 From: itamar Date: Sun, 24 May 2020 17:45:35 +0300 Subject: [PATCH 1/2] refactor start_test.sh Signed-off-by: itamar --- start_test.sh | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/start_test.sh b/start_test.sh index 8ad6cfc..94b20e3 100755 --- a/start_test.sh +++ b/start_test.sh @@ -21,8 +21,8 @@ then exit fi -jmx="$1" -[ -n "$jmx" ] || read -p 'Enter path to the jmx file ' jmx +jmx="$2" +[ -n "$jmx" ] || read -p 'Enter path to the jmx file:' jmx if [ ! -f "$jmx" ]; then @@ -33,6 +33,7 @@ fi test_name="$(basename "$jmx")" + #Get Master pod details master_pod=`kubectl -n $namespace get po | grep jmeter-master | awk '{print $1}'` @@ -41,4 +42,4 @@ 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" \ No newline at end of file +kubectl -n $namespace exec -ti $master_pod -- /bin/bash /load_test "$test_name" From 72d57c053d1ba941e70661b7d8719b285c3945aa Mon Sep 17 00:00:00 2001 From: itamar Date: Sun, 24 May 2020 17:44:53 +0300 Subject: [PATCH 2/2] new shell script - deploy csv config files to jmeter slaves Signed-off-by: itamar --- deploy_csv.sh | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100755 deploy_csv.sh diff --git a/deploy_csv.sh b/deploy_csv.sh new file mode 100755 index 0000000..e5bc7cc --- /dev/null +++ b/deploy_csv.sh @@ -0,0 +1,48 @@ +#!/usr/bin/env bash +#Script created to copy csv config file to jmeter slave pods +#It requires that you supply the path to the csv file and destination path in the jmeter pods + +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 + +csv="$2" +[ -n "$csv" ] || read -p 'Enter path to the csv file:' csv + +if [ ! -f "$csv" ]; +then + echo "csv file was not found in PATH" + echo "Kindly check and input the correct file path" + exit +fi + +csv_name="$(basename "$csv")" + +path="$3" +[ -n "$path" ] || read -p 'Enter destination path:' path + + + +#Get Master pod details + +kubectl -n $namespace get po | grep jmeter-slave | grep Running | awk '{print $1}' | while read -r slave_pod ; do + echo "Deploying $csv_name to: $slave_pod" + kubectl -n $namespace cp "$csv" "$slave_pod:$path/$csv_name" +done + + +