fix: disable background workers for tests

pull/9489/head
Luciano Righetti 2024-01-18 15:38:21 +01:00
parent f5babe9345
commit e72f664319
4 changed files with 6 additions and 2 deletions

View File

@ -533,7 +533,7 @@ class GalaxyClustersController extends AppController
if ($this->request->is('post') || $this->request->is('put')) {
$success = $this->GalaxyClusters->publishRouter($this->ACL->getUser()->toArray(), $cluster, $passAlong = null);
if (Configure::read('MISP.BackgroundJobs.enabled')) {
if (Configure::read('BackgroundJobs.enabled')) {
$message = __('Publish job queued. Job ID: %s', $success);
$this->Flash->success($message);
if ($this->ParamHandler->isRest()) {

View File

@ -534,7 +534,7 @@ class GalaxyClustersTable extends AppTable
*/
public function publishRouter(array $user, $cluster, $passAlong = null)
{
if (Configure::read('MISP.BackgroundJobs.enabled')) {
if (Configure::read('BackgroundJobs.enabled')) {
if (is_numeric($cluster)) {
$clusterId = $cluster;
} elseif (isset($cluster['GalaxyCluster'])) {

View File

@ -34,6 +34,7 @@ class UpdateGalaxiesApiTest extends TestCase
$this->setAuthToken(AuthKeysFixture::ADMIN_API_KEY);
Configure::write('BackgroundJobs.enabled', false);
Configure::write('MISP.custom_galaxies_path', '/var/www/html/tests/Libraries/misp-galaxy/galaxies/*.json');
Configure::write('MISP.custom_galaxy_clusters_path', '/var/www/html/tests/Libraries/misp-galaxy/clusters/*.json');

View File

@ -7,6 +7,7 @@ namespace App\Test\TestCase\Api\GalaxyClusters;
use App\Test\Fixture\AuthKeysFixture;
use App\Test\Fixture\GalaxyClustersFixture;
use App\Test\Helper\ApiTestTrait;
use Cake\Core\Configure;
use Cake\TestSuite\TestCase;
class PublishGalaxyClusterApiTest extends TestCase
@ -32,6 +33,8 @@ class PublishGalaxyClusterApiTest extends TestCase
{
$this->skipOpenApiValidations();
Configure::write('BackgroundJobs.enabled', false);
$this->setAuthToken(AuthKeysFixture::ADMIN_API_KEY);
$this->assertDbRecordExists(