Some checks failed
Security: Sync from Public / sync-from-public (push) Has been cancelled
Test: Benchmark Nightly / build (push) Has been cancelled
Test: Benchmark Nightly / Notify Cats on failure (push) Has been cancelled
CI: Python / Checks (push) Has been cancelled
Test: Evals Python / Workflow Comparison Python (push) Has been cancelled
Util: Check Docs URLs / check-docs-urls (push) Has been cancelled
Test: Visual Storybook / Cloudflare Pages (push) Has been cancelled
Test: E2E Performance / build-and-test-performance (push) Has been cancelled
Test: Workflows Nightly / Run Workflow Tests (push) Has been cancelled
Util: Cleanup CI Docker Images / Delete stale CI images (push) Has been cancelled
Test: Benchmark Destroy Env / build (push) Has been cancelled
Util: Update Node Popularity / update-popularity (push) Has been cancelled
Test: E2E Coverage Weekly / Coverage Tests (push) Has been cancelled
44 lines
1.4 KiB
TypeScript
44 lines
1.4 KiB
TypeScript
import { TaskRunnersConfig } from '@n8n/config';
|
|
import { Container } from '@n8n/di';
|
|
import { mock } from 'jest-mock-extended';
|
|
|
|
import { DefaultTaskRunnerDisconnectAnalyzer } from '@/task-runners/default-task-runner-disconnect-analyzer';
|
|
import { MissingAuthTokenError } from '@/task-runners/errors/missing-auth-token.error';
|
|
import { TaskBrokerWsServer } from '@/task-runners/task-broker/task-broker-ws-server';
|
|
import { TaskRunnerModule } from '@/task-runners/task-runner-module';
|
|
|
|
describe('TaskRunnerModule in external mode', () => {
|
|
const runnerConfig = Container.get(TaskRunnersConfig);
|
|
runnerConfig.mode = 'external';
|
|
runnerConfig.port = 0;
|
|
runnerConfig.authToken = 'test';
|
|
const module = Container.get(TaskRunnerModule);
|
|
|
|
afterEach(async () => {
|
|
await module.stop();
|
|
});
|
|
|
|
describe('start', () => {
|
|
it('should throw if auth token is missing', async () => {
|
|
const runnerConfig = new TaskRunnersConfig();
|
|
runnerConfig.mode = 'external';
|
|
runnerConfig.authToken = '';
|
|
|
|
const module = new TaskRunnerModule(mock(), mock(), runnerConfig, mock());
|
|
|
|
await expect(module.start()).rejects.toThrowError(MissingAuthTokenError);
|
|
});
|
|
|
|
it('should start the task runner', async () => {
|
|
// Act
|
|
await module.start();
|
|
});
|
|
|
|
it('should use DefaultTaskRunnerDisconnectAnalyzer', () => {
|
|
const wsServer = Container.get(TaskBrokerWsServer);
|
|
|
|
expect(wsServer.getDisconnectAnalyzer()).toBeInstanceOf(DefaultTaskRunnerDisconnectAnalyzer);
|
|
});
|
|
});
|
|
});
|