n8n/packages/cli/test/integration/task-runners/task-runner-module.internal.test.ts
Tomi Turtiainen a4757cf009
chore: Initial V2 changes (#22553)
Co-authored-by: Iván Ovejero <ivov.src@gmail.com>
Co-authored-by: yehorkardash <yehor.kardash@n8n.io>
Co-authored-by: Daria <daria.staferova@n8n.io>
Co-authored-by: Svetoslav Dekov <svetoslav.dekov@n8n.io>
Co-authored-by: Nikhil Kuriakose <nikhilkuria@gmail.com>
Co-authored-by: Charlie Kolb <charlie@n8n.io>
2025-12-01 20:44:59 +02:00

42 lines
1.3 KiB
TypeScript

import { TaskRunnersConfig } from '@n8n/config';
import { Container } from '@n8n/di';
import { InternalTaskRunnerDisconnectAnalyzer } from '@/task-runners/internal-task-runner-disconnect-analyzer';
import { TaskBrokerWsServer } from '@/task-runners/task-broker/task-broker-ws-server';
import { TaskRunnerModule } from '@/task-runners/task-runner-module';
describe('TaskRunnerModule in internal mode', () => {
const runnerConfig = Container.get(TaskRunnersConfig);
runnerConfig.port = 0; // Random port
runnerConfig.mode = 'internal';
runnerConfig.enabled = true;
runnerConfig.isNativePythonRunnerEnabled = false;
const module = Container.get(TaskRunnerModule);
afterEach(async () => {
await module.stop();
});
describe('start', () => {
it('should throw if the task runner is disabled', async () => {
runnerConfig.enabled = false;
// Act
await expect(module.start()).rejects.toThrow('Task runner is disabled');
});
it('should start the task runner', async () => {
runnerConfig.enabled = true;
// Act
await module.start();
});
it('should use InternalTaskRunnerDisconnectAnalyzer', () => {
const wsServer = Container.get(TaskBrokerWsServer);
expect(wsServer.getDisconnectAnalyzer()).toBeInstanceOf(InternalTaskRunnerDisconnectAnalyzer);
});
});
});