mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-18 10:31:15 +00:00
refactor(core): Move instanceType to InstanceSettings (no-changelog) (#10640)
This commit is contained in:
committed by
GitHub
parent
50beefb658
commit
25c8a328a8
@@ -5,7 +5,6 @@ import { InstanceSettings } from 'n8n-core';
|
||||
import { ApplicationError } from 'n8n-workflow';
|
||||
import Container from 'typedi';
|
||||
|
||||
import config from '@/config';
|
||||
import type { OrchestrationService } from '@/services/orchestration.service';
|
||||
import { mockInstance } from '@test/mocking';
|
||||
|
||||
@@ -70,7 +69,8 @@ describe('ScalingService', () => {
|
||||
|
||||
beforeEach(() => {
|
||||
jest.clearAllMocks();
|
||||
config.set('generic.instanceType', 'main');
|
||||
// @ts-expect-error readonly property
|
||||
instanceSettings.instanceType = 'main';
|
||||
instanceSettings.markAsLeader();
|
||||
|
||||
scalingService = new ScalingService(
|
||||
@@ -128,8 +128,8 @@ describe('ScalingService', () => {
|
||||
|
||||
describe('if worker', () => {
|
||||
it('should set up queue + listeners', async () => {
|
||||
// @ts-expect-error Private field
|
||||
scalingService.instanceType = 'worker';
|
||||
// @ts-expect-error readonly property
|
||||
instanceSettings.instanceType = 'worker';
|
||||
|
||||
await scalingService.setupQueue();
|
||||
|
||||
@@ -141,8 +141,8 @@ describe('ScalingService', () => {
|
||||
|
||||
describe('webhook', () => {
|
||||
it('should set up a queue + listeners', async () => {
|
||||
// @ts-expect-error Private field
|
||||
scalingService.instanceType = 'webhook';
|
||||
// @ts-expect-error readonly property
|
||||
instanceSettings.instanceType = 'webhook';
|
||||
|
||||
await scalingService.setupQueue();
|
||||
|
||||
@@ -155,8 +155,8 @@ describe('ScalingService', () => {
|
||||
|
||||
describe('setupWorker', () => {
|
||||
it('should set up a worker with concurrency', async () => {
|
||||
// @ts-expect-error Private field
|
||||
scalingService.instanceType = 'worker';
|
||||
// @ts-expect-error readonly property
|
||||
instanceSettings.instanceType = 'worker';
|
||||
await scalingService.setupQueue();
|
||||
const concurrency = 5;
|
||||
|
||||
@@ -172,8 +172,8 @@ describe('ScalingService', () => {
|
||||
});
|
||||
|
||||
it('should throw if called before queue is ready', async () => {
|
||||
// @ts-expect-error Private field
|
||||
scalingService.instanceType = 'worker';
|
||||
// @ts-expect-error readonly property
|
||||
instanceSettings.instanceType = 'worker';
|
||||
|
||||
expect(() => scalingService.setupWorker(5)).toThrow();
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user