fix(core): Fix task runner's task timeout and heartbeat interval (#14889)

This commit is contained in:
Iván Ovejero
2025-04-25 10:24:01 +02:00
committed by GitHub
parent 4bb165398c
commit cdf421e80f
3 changed files with 34 additions and 0 deletions

View File

@@ -120,6 +120,36 @@ describe('TaskRunnerProcess', () => {
expect(options.env).not.toHaveProperty('NODE_OPTIONS');
});
it('should pass N8N_RUNNERS_TASK_TIMEOUT if set', async () => {
jest.spyOn(authService, 'createGrantToken').mockResolvedValue('grantToken');
runnerConfig.taskTimeout = 123;
await taskRunnerProcess.start();
// @ts-expect-error The type is not correct
const options = spawnMock.mock.calls[0][2] as SpawnOptions;
expect(options.env).toEqual(
expect.objectContaining({
N8N_RUNNERS_TASK_TIMEOUT: '123',
}),
);
});
it('should pass N8N_RUNNERS_HEARTBEAT_INTERVAL if set', async () => {
jest.spyOn(authService, 'createGrantToken').mockResolvedValue('grantToken');
runnerConfig.heartbeatInterval = 456;
await taskRunnerProcess.start();
// @ts-expect-error The type is not correct
const options = spawnMock.mock.calls[0][2] as SpawnOptions;
expect(options.env).toEqual(
expect.objectContaining({
N8N_RUNNERS_HEARTBEAT_INTERVAL: '456',
}),
);
});
it('should use --disallow-code-generation-from-strings and --disable-proto=delete flags', async () => {
jest.spyOn(authService, 'createGrantToken').mockResolvedValue('grantToken');