mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 01:56:46 +00:00
refactor(core): Have one orchestration service per instance type (#7303)
webhook instances will not listen to either worker or event log messages on the Redis pub/sub channel
This commit is contained in:
committed by
GitHub
parent
193181a9c6
commit
afa683a06f
@@ -17,6 +17,8 @@ import { NodeTypes } from '@/NodeTypes';
|
||||
import { InternalHooks } from '@/InternalHooks';
|
||||
import { PostHogClient } from '@/posthog';
|
||||
import { RedisService } from '@/services/redis.service';
|
||||
import { OrchestrationHandlerWorkerService } from '@/services/orchestration/worker/orchestration.handler.worker.service';
|
||||
import { OrchestrationWorkerService } from '@/services/orchestration/worker/orchestration.worker.service';
|
||||
|
||||
const oclifConfig: Config.IConfig = new Config.Config({ root: __dirname });
|
||||
|
||||
@@ -48,17 +50,14 @@ test('worker initializes all its components', async () => {
|
||||
jest.spyOn(worker, 'initExternalHooks').mockImplementation(async () => {});
|
||||
jest.spyOn(worker, 'initExternalSecrets').mockImplementation(async () => {});
|
||||
jest.spyOn(worker, 'initEventBus').mockImplementation(async () => {});
|
||||
jest.spyOn(worker, 'initRedis');
|
||||
jest.spyOn(worker, 'initOrchestration');
|
||||
jest
|
||||
.spyOn(OrchestrationWorkerService.prototype, 'publishToEventLog')
|
||||
.mockImplementation(async () => {});
|
||||
jest
|
||||
.spyOn(OrchestrationHandlerWorkerService.prototype, 'initSubscriber')
|
||||
.mockImplementation(async () => {});
|
||||
jest.spyOn(RedisServicePubSubPublisher.prototype, 'init').mockImplementation(async () => {});
|
||||
jest
|
||||
.spyOn(RedisServicePubSubPublisher.prototype, 'publishToEventLog')
|
||||
.mockImplementation(async () => {});
|
||||
jest
|
||||
.spyOn(RedisServicePubSubSubscriber.prototype, 'subscribeToCommandChannel')
|
||||
.mockImplementation(async () => {});
|
||||
jest
|
||||
.spyOn(RedisServicePubSubSubscriber.prototype, 'addMessageHandler')
|
||||
.mockImplementation(async () => {});
|
||||
jest.spyOn(worker, 'initQueue').mockImplementation(async () => {});
|
||||
|
||||
await worker.init();
|
||||
@@ -71,13 +70,9 @@ test('worker initializes all its components', async () => {
|
||||
expect(worker.initExternalHooks).toHaveBeenCalled();
|
||||
expect(worker.initExternalSecrets).toHaveBeenCalled();
|
||||
expect(worker.initEventBus).toHaveBeenCalled();
|
||||
expect(worker.initRedis).toHaveBeenCalled();
|
||||
expect(worker.redisPublisher).toBeDefined();
|
||||
expect(worker.redisPublisher.init).toHaveBeenCalled();
|
||||
expect(worker.redisPublisher.publishToEventLog).toHaveBeenCalled();
|
||||
expect(worker.redisSubscriber).toBeDefined();
|
||||
expect(worker.redisSubscriber.subscribeToCommandChannel).toHaveBeenCalled();
|
||||
expect(worker.redisSubscriber.addMessageHandler).toHaveBeenCalled();
|
||||
expect(worker.initOrchestration).toHaveBeenCalled();
|
||||
expect(OrchestrationHandlerWorkerService.prototype.initSubscriber).toHaveBeenCalled();
|
||||
expect(OrchestrationWorkerService.prototype.publishToEventLog).toHaveBeenCalled();
|
||||
expect(worker.initQueue).toHaveBeenCalled();
|
||||
|
||||
jest.restoreAllMocks();
|
||||
|
||||
Reference in New Issue
Block a user