Skip to content

This repository helps you to deploy the latest version of JMeter on Openshift taking advantage of RH UBI images and Openshift resources.

License

Notifications You must be signed in to change notification settings

alvarolop/jmeter-on-ocp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

27 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Apache JMeter on Openshift

1. Introduction

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.

2. JMeter on your laptop: Building the container image

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

3. JMeter on your laptop: Running the image

podman run --rm -it --name jmeter localhost/jmeter:latest

4. JMeter on Openshift: Building the container image

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 -

5. JMeter on Openshift: Deploying the image

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 -

6. JMeter on Openshift: Obtaining JMeter reports

# 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

8. Annex: Running jmeter in your laptop

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

About

This repository helps you to deploy the latest version of JMeter on Openshift taking advantage of RH UBI images and Openshift resources.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published