This repository helps you to deploy the latest version of JMeter on Openshift taking advantage of RH UBI images and Openshift resources.
- 1. Introduction
- 2. JMeter on your laptop: Building the container image
- 3. JMeter on your laptop: Running the image
- 4. JMeter on Openshift: Building the container image
- 5. JMeter on Openshift: Deploying the image
- 6. JMeter on Openshift: Obtaining JMeter reports
- 7. Useful links
- 8. Annex: Running jmeter in your laptop
The Apache JMeter™ application is open source software, a 100% pure Java application designed to load test functional behavior and measure performance. It was originally designed for testing Web Applications but has since expanded to other test functions.
In order to perform some testing locally, you may want to build the JMeter image directly on your laptop.
podman build -t localhost/jmeter:latest ./container-image
podman run --rm -it --name jmeter localhost/jmeter:latest
If your have a disconnected Openshift installation, you will also require to build your application locally.
APP_NAMESPACE="jmeter"
GIT_REPOSITORY="https://github.com/alvarolop/jmeter-on-ocp.git"
oc new-project $APP_NAMESPACE --display-name="JMeter Testing" --description="This namespace contains resources to deploy JMeter"
oc process -f templates/jmeter-bc.yaml -p APP_NAMESPACE=$APP_NAMESPACE -p GIT_REPOSITORY=$GIT_REPOSITORY | oc apply -f -
First, create a ConfigMap that will store your application configuration:
JMETER_TEST="example"
oc create configmap jmeter-config -n $APP_NAMESPACE \
--from-file=${JMETER_TEST}.jmx=tests/${JMETER_TEST}/jmeter-test-plan.jmx \
--from-file=config.properties=tests/${JMETER_TEST}/config-k8s.properties
oc process -f templates/jmeter-dc.yaml \
-p APP_NAMESPACE=$APP_NAMESPACE \
-p TEST_NAME=$JMETER_TEST | oc apply -f -
# Get JMeter pod name
JMETER_POD=$(oc get pods -l app=jmeter -n $APP_NAMESPACE --template='{{(index .items 0).metadata.name}}')
NOW=$(date +"%Y-%m-%d_%H-%M-%S")
mkdir ./results/$NOW-$TEST
oc rsync $JMETER_POD:/opt/jmeter/results/$TEST-report/ ./results/$NOW-$TEST
-
Official Apache JMeter documentation.
JMETER_BASE=$(pwd)
TEST_PLAN=test-03
NOW=$(date +"%Y-%m-%d_%H-%M-%S"); jmeter -n -p "$JMETER_BASE/tests/${TEST_PLAN}/config.properties" -t "$JMETER_BASE/tests/${TEST_PLAN}/jmeter-test-plan.jmx" -l "$JMETER_BASE/results/${NOW}-${TEST_PLAN}.jtl" -e -o "$JMETER_BASE/results/${NOW}-${TEST_PLAN}-report"; cp -r $JMETER_BASE/tests/${TEST_PLAN}/ $JMETER_BASE/results/${NOW}-${TEST_PLAN}-report