Skip to content

Commit

Permalink
create a docker-jmeter module
Browse files Browse the repository at this point in the history
  • Loading branch information
lameze committed Nov 22, 2024
1 parent 54da0d6 commit 9b11d72
Show file tree
Hide file tree
Showing 2 changed files with 62 additions and 6 deletions.
7 changes: 1 addition & 6 deletions runner/main/jobtypes/performance/performance.sh
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ function performance_modules() {
moodle-core-copy
docker-healthy
docker-summary
docker-jmeter
)
echo "${modules[@]}"
}
Expand Down Expand Up @@ -113,12 +114,6 @@ function performance_setup_normal() {
cd moodle-performance-comparison
composer install

# Pull the JMeter Docker image.
docker pull justb4/jmeter

# Run the JMeter container.
docker run -d --name jmeter-container justb4/jmeter

# Init the Performance site.
echo
echo ">>> startsection Initialising Performance environment at $(date)<<<"
Expand Down
61 changes: 61 additions & 0 deletions runner/main/modules/docker-jmeter/docker-jmeter.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
#!/usr/bin/env bash
#
# This file is part of the Moodle Continuous Integration Project.
#
# Moodle is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Moodle is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Moodle. If not, see <https://www.gnu.org/licenses/>.

# Jmeter module functions.

# This module defines the following env variables.
function docker-jmeter_env() {
env=(
JMETERTESTURL
)
echo "${env[@]}"
}

# JMETER module checks.
function docker-jmeter_check() {
# Check all module dependencies.
verify_modules docker

# These env variables must be set for the database module to work.
verify_env NETWORK UUID
}

# JMETER module config.
function docker-jmeter_config() {
JMETER=jmeter"${UUID}"
JMETERTESTURL="jmeter://${JMETER}"
}

# JMETER module setup, launch the containers.
function docker-jmeter_setup() {
echo
echo ">>> startsection Starting Jmeter server <<<"
echo "============================================================================"

# Start the jmeter server
docker run \
--detach \
--name "${JMETER}" \
justb4/jmeter

echo "JMETER: URL: ${JMETERTESTURL}"
echo "JMETER logs:"
docker logs "${JMETER}"

echo "============================================================================"
echo ">>> stopsection <<<"
}

0 comments on commit 9b11d72

Please sign in to comment.