Skip to content

Commit d8f6034

Browse files
committed
Code clean up 3
1 parent db3549c commit d8f6034

File tree

1 file changed

+10
-15
lines changed

1 file changed

+10
-15
lines changed

runner/main/jobtypes/performance/performance.sh

Lines changed: 10 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -102,31 +102,22 @@ function performance_config() {
102102
export TARGET_FILE="${TARGET_FILE:-storage/performance/${MOODLE_BRANCH}/rundata.json}"
103103
}
104104

105-
# Performance job type setup.
106-
function performance_setup() {
107-
# If both GOOD_COMMIT and BAD_COMMIT are not set, we are going to run a normal session.
108-
# (for bisect sessions we don't have to setup the environment).
109-
if [[ -z "${GOOD_COMMIT}" ]] && [[ -z "${BAD_COMMIT}" ]]; then
110-
performance_setup_normal
111-
fi
112-
}
113-
114105
# Performance job type setup for normal mode.
115-
function performance_setup_normal() {
106+
function performance_setup() {
116107
# Init the Performance site.
117108
echo
118109
echo ">>> startsection Initialising Performance environment at $(date)<<<"
119110
echo "============================================================================"
111+
120112
local initcmd
121-
performance_initcmd initcmd # By nameref.
113+
performance_initcmd initcmd
122114
echo "Running: ${initcmd[*]}"
115+
docker exec -t -u www-data "${WEBSERVER}" "${initcmd[@]}"
123116

124117
# Ensure host shared directories exist and are writable so plugin can save files.
125118
mkdir -p "${SHAREDDIR}/planfiles" "${SHAREDDIR}/output/logs" "${SHAREDDIR}/output/runs"
126119
chmod -R 2777 "${SHAREDDIR}" || true
127120

128-
docker exec -t -u www-data "${WEBSERVER}" "${initcmd[@]}"
129-
130121
performance_perftoolcmd perftoolcmd
131122
docker exec -t -u www-data "${WEBSERVER}" "${perftoolcmd[@]}"
132123

@@ -153,11 +144,15 @@ function performance_run() {
153144
echo "============================================================================"
154145

155146
datestring=`date '+%Y%m%d%H%M'`
147+
156148
# Get the plan file name.
157149
testplanfile=`ls "${SHAREDDIR}"/*.jmx | head -1 | sed "s@${SHAREDDIR}@/shared@"`
158150
echo "Using test plan file: ${testplanfile}"
151+
152+
# Get the users file name.
159153
testusersfile=`ls "${SHAREDDIR}"/*.csv | head -1 | sed "s@${SHAREDDIR}@/shared@"`
160154
echo "Using test users file: ${testusersfile}"
155+
161156
group="${MOODLE_BRANCH}"
162157
description="${GIT_COMMIT}"
163158
siteversion=""
@@ -171,12 +166,12 @@ function performance_run() {
171166

172167
# Calculate the command to run. The function will return the command in the passed array.
173168
local jmeterruncmd=
174-
performance_main_command jmeterruncmd # By nameref.
169+
performance_main_command jmeterruncmd
175170

176171
echo "Running performance command: ${jmeterruncmd[*]}"
177172
echo ">>> Performance run at $(date) <<<"
178173
local dockerrunargs=
179-
docker-jmeter_run_args dockerrunargs # By nameref
174+
docker-jmeter_run_args dockerrunargs
180175

181176
echo "${dockerrunargs[@]}"
182177
echo docker run ${dockerrunargs[@]} ${jmeterruncmd[@]}

0 commit comments

Comments
 (0)