2 # ============LICENSE_START=======================================================
3 # Copyright (C) 2023 Nordix Foundation. All rights reserved.
4 # ================================================================================
5 # Licensed under the Apache License, Version 2.0 (the "License");
6 # you may not use this file except in compliance with the License.
7 # You may obtain a copy of the License at
9 # http://www.apache.org/licenses/LICENSE-2.0
11 # Unless required by applicable law or agreed to in writing, software
12 # distributed under the License is distributed on an "AS IS" BASIS,
13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 # See the License for the specific language governing permissions and
15 # limitations under the License.
17 # SPDX-License-Identifier: Apache-2.0
18 # ============LICENSE_END=========================================================
20 # This script will be used to automatically trigger the S3P
21 # tests for policy components.
24 function start_kubernetes() {
25 bash run-k8s-csit.sh install
26 bash get-cluster-info.sh
29 function install_jmeter() {
31 #NOTE: $TESTDIR is set by the component triggering this script
32 cd ${TESTDIR}/automate-performance
37 sudo apt install curl -y
40 sudo apt install -y default-jdk
43 curl -O https://archive.apache.org/dist/jmeter/binaries/apache-jmeter-5.3.tgz
44 tar -xvf apache-jmeter-5.3.tgz
46 # Remove unnecessary files
47 rm -rf apache-jmeter-5.3/docs apache-jmeter-5.3/printable_docs
50 cd apache-jmeter-5.3/lib
51 curl -O https://repo1.maven.org/maven2/kg/apc/cmdrunner/2.2.1/cmdrunner-2.2.1.jar
53 # Install Plugin Manager
55 curl -O https://repo1.maven.org/maven2/kg/apc/jmeter-plugins-manager/1.6/jmeter-plugins-manager-1.6.jar
59 java -jar cmdrunner-2.2.1.jar --tool org.jmeterplugins.repository.PluginManagerCMD install-all-except jpgc-hadoop,jpgc-oauth,ulp-jmeter-autocorrelator-plugin,ulp-jmeter-videostreaming-plugin,ulp-jmeter-gwt-plugin,tilln-iso8583
62 sudo cp -r ../../apache-jmeter-5.3 /opt/
64 # Add JMeter Path Variable
66 JMETER_HOME="/opt/apache-jmeter-5.3"
67 PATH="$JMETER_HOME/bin:$PATH"
72 # TODO: Generate report
73 echo "Generating report..."
77 echo "Removing temp directories.."
79 rm -r ${TESTDIR}/automate-performance
81 echo "Removed directories"
83 echo "Tearing down kubernetes cluster..."
84 bash run-k8s-csit.sh uninstall
86 # DELETE created services
87 microk8s kubectl get svc | awk '/svc/{system("microk8s kubectl delete svc " $1)}'
95 echo "==========================="
96 echo "Starting K8s Environment"
97 echo "==========================="
100 echo "==========================="
101 echo "Installing JMeter"
102 echo "==========================="
105 # Run the JMX test plan
106 echo "==========================="
107 echo "Executing tests"
108 echo "==========================="
109 cd ${TESTDIR}/automate-performance || exit
110 nohup apache-jmeter-5.3/bin/jmeter -n -t $2 -l s3pTestResults.jtl
112 # TODO: Generate report on on_exit()
114 elif [ $1 == "uninstall" ]
116 echo "Uninstalling environment and removing temp folders..."
119 echo "Invalid arguments provided. Usage: $0 [option..] {run | uninstall}"