Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions classes/check/tasklatencycheck.php
Original file line number Diff line number Diff line change
Expand Up @@ -132,10 +132,10 @@ public function get_result(): result {
$table = new \xmldb_table('task_log');
if ($dbman->table_exists($table)) {
// We can use task logs!
$sql = "SELECT (timeend - timestart) AS duration
$sql = "SELECT (endtime - starttime) AS duration
FROM {task_log}
WHERE classname = ?
ORDER BY timeend DESC
ORDER BY endtime DESC
LIMIT 1";
$record = $DB->get_record_sql($sql, [$taskclass]);

Expand Down
4 changes: 1 addition & 3 deletions tests/check/dirsizes_totara_test.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.

namespace tool_heartbeat\check;

use tool_heartbeat\check\dirsizes;

/**
Expand All @@ -28,7 +26,7 @@
*
* @coversDefaultClass \tool_heartbeat\check\dirsizes
*/
final class dirsizes_totara_test extends \externallib_advanced_testcase {
class dirsizes_totara_test extends \core_phpunit\testcase {
protected function setUp(): void {
parent::setUp();
$this->resetAfterTest(true);
Expand Down
16 changes: 7 additions & 9 deletions tests/check/tasklatencycheck_test.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.

namespace tool_heartbeat;

use core\check\result;

/**
Expand All @@ -26,7 +24,7 @@
* @copyright 2022, Catalyst IT
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class tasklatencycheck_test extends \externallib_advanced_testcase {
class tasklatencycheck_test extends \core_phpunit\testcase {
/**
* Test check for tasks start time delay.
*
Expand Down Expand Up @@ -171,8 +169,8 @@ public function test_task_run_duration() {
// Test a good duration.
// We need to set different field based on whether lockstats or logs for all these tests.
if ($logs) {
$logrecord['timestart'] = time() - 15 * MINSECS;
$logrecord['timeend'] = time() - 12 * MINSECS;
$logrecord['starttime'] = time() - 15 * MINSECS;
$logrecord['endtime'] = time() - 12 * MINSECS;
$DB->insert_record('task_log', $logrecord);

} else {
Expand All @@ -186,8 +184,8 @@ public function test_task_run_duration() {

// Now test a negative duration. Can never happen, but the check shouldn't barf.
if ($logs) {
$logrecord['timestart'] = time() - 12 * MINSECS;
$logrecord['timeend'] = time() - 15 * MINSECS;
$logrecord['starttime'] = time() - 12 * MINSECS;
$logrecord['endtime'] = time() - 15 * MINSECS;
$DB->delete_records('task_log');
$DB->insert_record('task_log', $logrecord);

Expand All @@ -203,8 +201,8 @@ public function test_task_run_duration() {

// Now test a duration longer than the configured duration.
if ($logs) {
$logrecord['timestart'] = time() - 15 * MINSECS;
$logrecord['timeend'] = time() - 5 * MINSECS;
$logrecord['starttime'] = time() - 15 * MINSECS;
$logrecord['endtime'] = time() - 5 * MINSECS;
$DB->delete_records('task_log');
$DB->insert_record('task_log', $logrecord);

Expand Down
Loading