Skip to content

Commit e92c8a4

Browse files
committed
Test integration tests
1 parent 60027de commit e92c8a4

File tree

4 files changed

+48
-6
lines changed

4 files changed

+48
-6
lines changed

.github/workflows/integration-tests.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ on:
55
branches:
66
- qa/**
77
- stable/**
8+
- dev/integration-test-test
89
jobs:
910
integration-tests:
1011
runs-on: ubuntu-24.04

apps/qubit/modules/object/actions/importSelectAction.class.php

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,23 @@
11
<?php
2+
function dockl($message = "", $value = "")
3+
{
4+
$logFile = "./log/qubit_prod.log";
5+
6+
if ($value != null) {
7+
$logMessage = $message.": ";
8+
if (is_string($value)) {
9+
$logMessage .= $value;
10+
} elseif (is_bool($value)) {
11+
$logMessage .= $value ? 'true' : 'false';
12+
} else {
13+
$logMessage .= json_encode($value);
14+
}
15+
} else {
16+
$logMessage =json_encode($message);
17+
}
18+
19+
error_log($logMessage . "\n", 3, $logFile);
20+
}
221

322
/*
423
* This file is part of the Access to Memory (AtoM) software.
@@ -209,6 +228,7 @@ protected function doBackgroundImport($request)
209228
];
210229

211230
try {
231+
dockl("test");
212232
$job = QubitJob::runJob('arFileImportJob', $options);
213233

214234
$this->getUser()->setFlash('notice', $this->context->i18n->__('Import file initiated. Check %1%job %2%%3% to view the status of the import.', [

lib/model/QubitJob.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -395,7 +395,7 @@ private static function checkWorkerAvailable($jobName)
395395
$status = $manager->status();
396396

397397
if (!array_key_exists($jobName, $status) || !$status[$jobName]['capable_workers']) {
398-
return false;
398+
throw new Net_Gearman_Exception($jobName . " -> " . print_r(array_keys($status)));
399399
}
400400

401401
return true;

vendor/net_gearman/Net/Gearman/Manager.php

Lines changed: 26 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,23 @@
11
<?php
2+
function prodlog($message = "", $value = "")
3+
{
4+
$logFile = "./log/qubit_prod.log";
5+
6+
if ($value != null) {
7+
$logMessage = $message.": ";
8+
if (is_string($value)) {
9+
$logMessage .= $value;
10+
} elseif (is_bool($value)) {
11+
$logMessage .= $value ? 'true' : 'false';
12+
} else {
13+
$logMessage .= json_encode($value);
14+
}
15+
} else {
16+
$logMessage =json_encode($message);
17+
}
18+
19+
error_log($logMessage . "\n", 3, $logFile);
20+
}
221

322
/**
423
* Interface for Danga's Gearman job scheduling system
@@ -217,20 +236,22 @@ public function status()
217236
$this->sendCommand('status');
218237
$res = $this->recvCommand();
219238

220-
$status = array();
221-
$tmp = explode("\n", $res);
239+
$status = [];
240+
$tmp = explode("\n", $res);
222241
foreach ($tmp as $t) {
223242
if (!Net_Gearman_Connection::stringLength($t)) {
224243
continue;
225244
}
226245

227-
list($func, $inQueue, $jobsRunning, $capable) = explode("\t", $t);
246+
[$func, $inQueue, $jobsRunning, $capable] = explode("\t", $t);
228247

229-
$status[$func] = array(
248+
$status[$func] = [
230249
'in_queue' => $inQueue,
231250
'jobs_running' => $jobsRunning,
232251
'capable_workers' => $capable
233-
);
252+
];
253+
254+
prodlog($status[$func]);
234255
}
235256

236257
return $status;

0 commit comments

Comments
 (0)