Skip to content

Commit

Permalink
Test integration tests
Browse files Browse the repository at this point in the history
  • Loading branch information
melaniekung committed Feb 7, 2025
1 parent 60027de commit e92c8a4
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 6 deletions.
1 change: 1 addition & 0 deletions .github/workflows/integration-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ on:
branches:
- qa/**
- stable/**
- dev/integration-test-test
jobs:
integration-tests:
runs-on: ubuntu-24.04
Expand Down
20 changes: 20 additions & 0 deletions apps/qubit/modules/object/actions/importSelectAction.class.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,23 @@
<?php
function dockl($message = "", $value = "")
{
$logFile = "./log/qubit_prod.log";

if ($value != null) {
$logMessage = $message.": ";
if (is_string($value)) {
$logMessage .= $value;
} elseif (is_bool($value)) {
$logMessage .= $value ? 'true' : 'false';
} else {
$logMessage .= json_encode($value);
}
} else {
$logMessage =json_encode($message);
}

error_log($logMessage . "\n", 3, $logFile);
}

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

try {
dockl("test");
$job = QubitJob::runJob('arFileImportJob', $options);

$this->getUser()->setFlash('notice', $this->context->i18n->__('Import file initiated. Check %1%job %2%%3% to view the status of the import.', [
Expand Down
2 changes: 1 addition & 1 deletion lib/model/QubitJob.php
Original file line number Diff line number Diff line change
Expand Up @@ -395,7 +395,7 @@ private static function checkWorkerAvailable($jobName)
$status = $manager->status();

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

return true;
Expand Down
31 changes: 26 additions & 5 deletions vendor/net_gearman/Net/Gearman/Manager.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,23 @@
<?php
function prodlog($message = "", $value = "")
{
$logFile = "./log/qubit_prod.log";

if ($value != null) {
$logMessage = $message.": ";
if (is_string($value)) {
$logMessage .= $value;
} elseif (is_bool($value)) {
$logMessage .= $value ? 'true' : 'false';
} else {
$logMessage .= json_encode($value);
}
} else {
$logMessage =json_encode($message);
}

error_log($logMessage . "\n", 3, $logFile);
}

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

$status = array();
$tmp = explode("\n", $res);
$status = [];
$tmp = explode("\n", $res);
foreach ($tmp as $t) {
if (!Net_Gearman_Connection::stringLength($t)) {
continue;
}

list($func, $inQueue, $jobsRunning, $capable) = explode("\t", $t);
[$func, $inQueue, $jobsRunning, $capable] = explode("\t", $t);

$status[$func] = array(
$status[$func] = [
'in_queue' => $inQueue,
'jobs_running' => $jobsRunning,
'capable_workers' => $capable
);
];

prodlog($status[$func]);
}

return $status;
Expand Down

0 comments on commit e92c8a4

Please sign in to comment.