Skip to content

Commit

Permalink
More finalisation
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewnicols committed Dec 26, 2024
1 parent 65163a4 commit 7ae73d1
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 51 deletions.
41 changes: 41 additions & 0 deletions runner/main/jobtypes/performance/normalise_site.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
<?php

/**
* Sets all of Moodle's advanced features and
*/

define('CLI_SCRIPT', true);
require_once(__DIR__ . '/moodle/config.php');
require_once(__DIR__ . '/moodle/lib/adminlib.php');

$settings = array(
'debugdisplay', 'enablenotes', 'enableblogs', 'enablebadges', 'enableoutcomes',
'enableportfolios', 'enablerssfeeds', 'enablecompletion', 'enablecourserequests',
'enableavailability', 'enableplagiarism', 'enablegroupmembersonly', 'enablegravatar',
'enablesafebrowserintegration', 'usecomments', 'dndallowtextandlinks', 'gradepublishing'
);

// Enable all of Moodle's features that adds functionality to the default settings.
foreach ($settings as $setting) {
set_config($setting, 1);
}

// Update admin user info in case we want to log in to set cache stores other configs...
$user = $DB->get_record('user', array('username' => 'admin'));
$user->email = '[email protected]';
$user->firstname = 'Admin';
$user->lastname = 'User';
$user->city = 'Perth';
$user->country = 'AU';
$DB->update_record('user', $user);

// Disable email message processor.
$DB->set_field('message_processors', 'enabled', '0', array('name' => 'email'));

// Course list when not logged in and enrolled courses when logged as a usual configuration.
$frontpage = new admin_setting_courselist_frontpage(false);
$frontpage->write_setting(array(FRONTPAGEALLCOURSELIST));
$frontpagelogged = new admin_setting_courselist_frontpage(true);
$frontpagelogged->write_setting(array(FRONTPAGEENROLLEDCOURSELIST));

echo "Moodle site configuration finished successfully.\n";
11 changes: 8 additions & 3 deletions runner/main/jobtypes/performance/performance.sh
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,11 @@ function performance_setup_normal() {
echo "Running: ${initcmd[*]}"
docker exec -t -u www-data "${WEBSERVER}" "${initcmd[@]}"

# Copy the site normalisation script and execute it.
echo "Copying and executing the site normalisation script"
docker cp "${BASEDIR}/jobtypes/performance/normalise_site.php" "${WEBSERVER}:/var/www/html/normalise_site.php"
docker exec -t -u www-data "${WEBSERVER}" php /var/www/html/normalise_site.php

echo "Creating test data"
performance_generate_test_data

Expand Down Expand Up @@ -196,11 +201,11 @@ function performance_run() {
testplanfile=`ls "${SHAREDDIR}"/planfiles/*.jmx | head -1 | sed "s@${SHAREDDIR}@/shared@"`
testusersfile=`ls "${SHAREDDIR}"/planfiles/*.csv | head -1 | sed "s@${SHAREDDIR}@/shared@"`
group="${MOODLE_BRANCH}"
description="${MOODLE_BRANCH}"
description="${GIT_COMMIT}"
siteversion=""
sitebranch="${MOODLE_BRANCH}"
sitecommit="${MOODLE_BRANCH}"
runoutput="${SHAREDDIR}/output/results/$datestring.output"
sitecommit="${GIT_COMMIT}"
runoutput="${SHAREDDIR}/output/logs/run.log"

# Calculate the command to run. The function will return the command in the passed array.
local jmeterruncmd=
Expand Down
48 changes: 0 additions & 48 deletions runner/main/modules/docker-jmeter/libraries/recorder.bsf
Original file line number Diff line number Diff line change
Expand Up @@ -193,54 +193,10 @@ WritePhpLine(String line) {
Runnable mr = MoodleResult(ctx);

// We add the run info when starting the first thread
DebugValue("Checking if header printed");
if (JMeterUtils.getProperty("headerprinted") == null) {
DebugValue("Header not printed - adding it now");
// Output headers.
JMeterUtils.setProperty("headerprinted", "1");
print(mr.headerToString());
DebugValue(mr.headerToString());

DebugValue("Host:");
DebugValue(vars.get("host"));

DebugValue("Site path:");
DebugValue(vars.get("sitepath"));

DebugValue("Group:");
DebugValue(props.get("group"));

DebugValue("Run Desec:");
DebugValue(props.get("desc"));

DebugValue("Users:");
DebugValue(vars.get("users"));

DebugValue("Loops:");
DebugValue(vars.get("loops"));

DebugValue("Rampup:");
DebugValue(vars.get("rampup"));

DebugValue("Throughput:");
DebugValue(vars.get("throughput"));

DebugValue("Size:");
DebugValue(vars.get("size"));

DebugValue("Base:");
DebugValue(vars.get("moodleversion"));

DebugValue("Site version:");
DebugValue(props.get("siteversion"));

DebugValue("Site branch:");
DebugValue(props.get("sitebranch"));

DebugValue("Site Commit:");
DebugValue(props.get("sitecommit"));

DebugValue("All done");

WritePhpValue("host", vars.get("host"));
WritePhpValue("sitepath", vars.get("sitepath"));
Expand All @@ -258,12 +214,8 @@ if (JMeterUtils.getProperty("headerprinted") == null) {

// Send the run timestamp to set it as run filename.
props.put("filepath", "runs/" + vars.get("runtimestamp") + ".php");
DebugValue("Header now printed");
} else {
DebugValue("Header printed");
}

WritePhpLine(mr.toPHP());

print(mr.toString());
DebugValue(mr.toString());

0 comments on commit 7ae73d1

Please sign in to comment.