Skip to content

Commit

Permalink
feat: minor jmeterd updates (#4503)
Browse files Browse the repository at this point in the history
* minor updated to jmeterd

* remove more redundant logic in jmeterd
  • Loading branch information
dejanzele authored Oct 24, 2023
1 parent 991e023 commit a4523b2
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 59 deletions.
2 changes: 1 addition & 1 deletion contrib/executor/jmeterd/pkg/runner/runner.go
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ func (r *JMeterDRunner) Run(ctx context.Context, execution testkube.Execution) (
//Skip JVM ARGS to be appended in the command
continue
}
params = append(params, fmt.Sprintf("-J%s=%s", value.Name, value.Value))
params = append(params, fmt.Sprintf("-G%s=%s", value.Name, value.Value))

}

Expand Down
13 changes: 0 additions & 13 deletions contrib/executor/jmeterd/scripts/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -1,18 +1,5 @@
#!/bin/bash

EXECUTOR_CUSTOM_PLUGINS_FOLDER="${RUNNER_DATADIR}/uploads/plugins"

if [ -d $EXECUTOR_CUSTOM_PLUGINS_FOLDER ];
then
echo "Copying custom plugins from ${EXECUTOR_CUSTOM_PLUGINS_FOLDER} to ${JMETER_HOME}/lib/ext"
for plugin in ${EXECUTOR_CUSTOM_PLUGINS_FOLDER}/*.jar; do
echo "Copying plugin: $plugin"
cp $plugin ${JMETER_HOME}/lib/ext
done;
else
echo "No custom plugins found at ${EXECUTOR_CUSTOM_PLUGINS_FOLDER}"
fi

if [ -f "/executor_entrypoint_master.sh" ];
then
echo "Executing custom entrypoint script at /entrypoint.sh"
Expand Down
44 changes: 14 additions & 30 deletions contrib/executor/jmeterd/scripts/jmeter-master.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,23 +5,6 @@ echo "* Installing JMeter Plugins *"
echo "********************************************************"
echo



if [ -d $JMETER_CUSTOM_PLUGINS_FOLDER ]
then
echo "Installing custom plugins from ${JMETER_CUSTOM_PLUGINS_FOLDER}"
for plugin in ${JMETER_CUSTOM_PLUGINS_FOLDER}/*.jar; do
echo "Copying plugin $plugin to ${JMETER_HOME}/lib/ext/${plugin}"
cp $plugin ${JMETER_HOME}/lib/ext
done;
else
echo "No custom plugins found in ${JMETER_CUSTOM_PLUGINS_FOLDER}"
fi
echo




if [ -d ${JMETER_PARENT_TEST_FOLDER}/plugins ]
then
echo "Installing user plugins from ${JMETER_PARENT_TEST_FOLDER}/plugins"
Expand All @@ -34,15 +17,25 @@ else
fi
echo

if [ -f ${JMETER_PARENT_TEST_FOLDER}/user.properties ]
BASE_PROPERTIES_FILE=${JMETER_PARENT_TEST_FOLDER}/user.properties
if [ -f "${BASE_PROPERTIES_FILE}" ]
then
echo "Copying user properties file from ${JMETER_PARENT_TEST_FOLDER}/user.properties"
cp ${JMETER_PARENT_TEST_FOLDER}/user.properties ${JMETER_HOME}/bin/
echo "Copying user properties file from ${BASE_PROPERTIES_FILE}"
cp ${BASE_PROPERTIES_FILE} ${JMETER_HOME}/bin/
else
echo "File user.properties not present in ${JMETER_PARENT_TEST_FOLDER}"
fi
echo

NESTED_PROPERTIES_FILE=${JMETER_PARENT_TEST_FOLDER}/properties/user.properties
if [ -f "${NESTED_PROPERTIES_FILE}" ]
then
echo "Copying user properties file from ${NESTED_PROPERTIES_FILE}"
cp ${NESTED_PROPERTIES_FILE} ${JMETER_HOME}/bin/
else
echo "File user.properties not present in ${JMETER_PARENT_TEST_FOLDER}/properties"
fi
echo

echo "********************************************************"
echo "* Initializing JMeter Master *"
Expand All @@ -55,7 +48,7 @@ freeMem=$(awk '/MemAvailable/ { print int($2/1024) }' /proc/meminfo)
[[ -z ${JVM_XMS} ]] && JVM_XMS=$(($freeMem*8/10))
[[ -z ${JVM_XMX} ]] && JVM_XMX=$(($freeMem*8/10))

echo "Setting default JVM_ARGS=-Xmn${JVM_XMN}m -Xms${JVM_XMS}m -Xmx${JVM_XMX}m"
echo "Setting dynamically heap size based on available resources JVM_ARGS=-Xmn${JVM_XMN}m -Xms${JVM_XMS}m -Xmx${JVM_XMX}m"
export JVM_ARGS="-Xmn${JVM_XMN}m -Xms${JVM_XMS}m -Xmx${JVM_XMX}m"

if [ -n "$MASTER_OVERRIDE_JVM_ARGS" ]; then
Expand All @@ -72,15 +65,6 @@ echo "Available memory: ${freeMem} MB"
echo "Configured JVM_ARGS=${JVM_ARGS}"
echo

echo "********************************************************"
echo "* Preparing JMeter Test Execution *"
echo "********************************************************"
echo

# Keep entrypoint simple: we must pass the standard JMeter arguments
EXTRA_ARGS=-Dlog4j2.formatMsgNoLookups=true


echo "********************************************************"
echo "* Executing JMeter tests *"
echo "********************************************************"
Expand Down
16 changes: 1 addition & 15 deletions contrib/executor/jmeterd/scripts/jmeter-slaves.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,6 @@ echo "* Installing JMeter Plugins *"
echo "********************************************************"
echo

if [ -d $JMETER_CUSTOM_PLUGINS_FOLDER ]
then
echo "Installing custom plugins from ${JMETER_CUSTOM_PLUGINS_FOLDER}"
for plugin in ${JMETER_CUSTOM_PLUGINS_FOLDER}/*.jar; do
echo "Copying plugin $plugin to ${JMETER_HOME}/lib/ext/${plugin}"
cp $plugin ${JMETER_HOME}/lib/ext
done;
else
echo "No custom plugins found in ${JMETER_CUSTOM_PLUGINS_FOLDER}"
fi
echo

if [ -d ${JMETER_PARENT_TEST_FOLDER}/plugins ]
then
echo "Installing user plugins from ${JMETER_PARENT_TEST_FOLDER}/plugins"
Expand All @@ -29,8 +17,6 @@ else
fi
echo

echo

echo "********************************************************"
echo "* Initializing JMeter Master *"
echo "********************************************************"
Expand All @@ -42,7 +28,7 @@ freeMem=`awk '/MemAvailable/ { print int($2/1024) }' /proc/meminfo`
[[ -z ${JVM_XMS} ]] && JVM_XMS=$(($freeMem/10*8))
[[ -z ${JVM_XMX} ]] && JVM_XMX=$(($freeMem/10*8))

echo "Setting default JVM_ARGS=-Xmn${JVM_XMN}m -Xms${JVM_XMS}m -Xmx${JVM_XMX}m"
echo "Setting dynamically heap size based on available resources JVM_ARGS=-Xmn${JVM_XMN}m -Xms${JVM_XMS}m -Xmx${JVM_XMX}m"
export JVM_ARGS="-Xmn${JVM_XMN}m -Xms${JVM_XMS}m -Xmx${JVM_XMX}m"

if [ -n "$OVERRIDE_JVM_ARGS" ]; then
Expand Down

0 comments on commit a4523b2

Please sign in to comment.