mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-20 11:22:15 +00:00
refactor(core): Bundle the go based launcher to the n8n docker image (no-changelog) (#11792)
Co-authored-by: Iván Ovejero <ivov.src@gmail.com>
This commit is contained in:
@@ -11,7 +11,7 @@ describe('TaskRunnerProcess', () => {
|
||||
const authToken = 'token';
|
||||
const runnerConfig = Container.get(TaskRunnersConfig);
|
||||
runnerConfig.enabled = true;
|
||||
runnerConfig.mode = 'internal_childprocess';
|
||||
runnerConfig.mode = 'internal';
|
||||
runnerConfig.authToken = authToken;
|
||||
runnerConfig.port = 0; // Use any port
|
||||
const taskRunnerServer = Container.get(TaskRunnerServer);
|
||||
@@ -20,11 +20,6 @@ describe('TaskRunnerProcess', () => {
|
||||
const taskBroker = Container.get(TaskBroker);
|
||||
const taskRunnerService = Container.get(TaskRunnerWsServer);
|
||||
|
||||
const startLauncherSpy = jest.spyOn(runnerProcess, 'startLauncher');
|
||||
const startNodeSpy = jest.spyOn(runnerProcess, 'startNode');
|
||||
const killLauncherSpy = jest.spyOn(runnerProcess, 'killLauncher');
|
||||
const killNodeSpy = jest.spyOn(runnerProcess, 'killNode');
|
||||
|
||||
beforeAll(async () => {
|
||||
await taskRunnerServer.start();
|
||||
// Set the port to the actually used port
|
||||
@@ -37,11 +32,6 @@ describe('TaskRunnerProcess', () => {
|
||||
|
||||
afterEach(async () => {
|
||||
await runnerProcess.stop();
|
||||
|
||||
startLauncherSpy.mockClear();
|
||||
startNodeSpy.mockClear();
|
||||
killLauncherSpy.mockClear();
|
||||
killNodeSpy.mockClear();
|
||||
});
|
||||
|
||||
const getNumConnectedRunners = () => taskRunnerService.runnerConnections.size;
|
||||
@@ -100,46 +90,4 @@ describe('TaskRunnerProcess', () => {
|
||||
expect(getNumRegisteredRunners()).toBe(1);
|
||||
expect(runnerProcess.pid).not.toBe(processId);
|
||||
});
|
||||
|
||||
it('should launch runner directly if not using a launcher', async () => {
|
||||
runnerConfig.mode = 'internal_childprocess';
|
||||
|
||||
await runnerProcess.start();
|
||||
|
||||
expect(startLauncherSpy).toBeCalledTimes(0);
|
||||
expect(startNodeSpy).toBeCalledTimes(1);
|
||||
});
|
||||
|
||||
it('should use a launcher if configured', async () => {
|
||||
runnerConfig.mode = 'internal_launcher';
|
||||
runnerConfig.launcherPath = 'node';
|
||||
|
||||
await runnerProcess.start();
|
||||
|
||||
expect(startLauncherSpy).toBeCalledTimes(1);
|
||||
expect(startNodeSpy).toBeCalledTimes(0);
|
||||
runnerConfig.mode = 'internal_childprocess';
|
||||
});
|
||||
|
||||
it('should kill the process directly if not using a launcher', async () => {
|
||||
runnerConfig.mode = 'internal_childprocess';
|
||||
|
||||
await runnerProcess.start();
|
||||
await runnerProcess.stop();
|
||||
|
||||
expect(killLauncherSpy).toBeCalledTimes(0);
|
||||
expect(killNodeSpy).toBeCalledTimes(1);
|
||||
});
|
||||
|
||||
it('should kill the process using a launcher if configured', async () => {
|
||||
runnerConfig.mode = 'internal_launcher';
|
||||
runnerConfig.launcherPath = 'node';
|
||||
|
||||
await runnerProcess.start();
|
||||
await runnerProcess.stop();
|
||||
|
||||
expect(killLauncherSpy).toBeCalledTimes(1);
|
||||
expect(killNodeSpy).toBeCalledTimes(0);
|
||||
runnerConfig.mode = 'internal_childprocess';
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user