test(core): Allow Jest to exit cleanly in worker command test (#11095)

This commit is contained in:
Iván Ovejero 2024-10-04 14:44:53 +02:00 committed by GitHub
parent caeda22811
commit d537cea363
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -10,6 +10,7 @@ import { ExternalHooks } from '@/external-hooks';
import { ExternalSecretsManager } from '@/external-secrets/external-secrets-manager.ee'; import { ExternalSecretsManager } from '@/external-secrets/external-secrets-manager.ee';
import { License } from '@/license'; import { License } from '@/license';
import { LoadNodesAndCredentials } from '@/load-nodes-and-credentials'; import { LoadNodesAndCredentials } from '@/load-nodes-and-credentials';
import { Publisher } from '@/scaling/pubsub/publisher.service';
import { ScalingService } from '@/scaling/scaling.service'; import { ScalingService } from '@/scaling/scaling.service';
import { OrchestrationHandlerWorkerService } from '@/services/orchestration/worker/orchestration.handler.worker.service'; import { OrchestrationHandlerWorkerService } from '@/services/orchestration/worker/orchestration.handler.worker.service';
import { OrchestrationWorkerService } from '@/services/orchestration/worker/orchestration.worker.service'; import { OrchestrationWorkerService } from '@/services/orchestration/worker/orchestration.worker.service';
@ -29,12 +30,12 @@ const logStreamingEventRelay = mockInstance(LogStreamingEventRelay);
const orchestrationHandlerWorkerService = mockInstance(OrchestrationHandlerWorkerService); const orchestrationHandlerWorkerService = mockInstance(OrchestrationHandlerWorkerService);
const scalingService = mockInstance(ScalingService); const scalingService = mockInstance(ScalingService);
const orchestrationWorkerService = mockInstance(OrchestrationWorkerService); const orchestrationWorkerService = mockInstance(OrchestrationWorkerService);
mockInstance(Publisher);
const command = setupTestCommand(Worker); const command = setupTestCommand(Worker);
test('worker initializes all its components', async () => { test('worker initializes all its components', async () => {
const worker = await command.run(); const worker = await command.run();
expect(worker.queueModeId).toBeDefined(); expect(worker.queueModeId).toBeDefined();
expect(worker.queueModeId).toContain('worker'); expect(worker.queueModeId).toContain('worker');
expect(worker.queueModeId.length).toBeGreaterThan(15); expect(worker.queueModeId.length).toBeGreaterThan(15);