-
Notifications
You must be signed in to change notification settings - Fork 8.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' of https://github.com/n8n-io/n8n into node-2026-…
…community-issue-n8n-form-node-double-pop-up-fix
- Loading branch information
Showing
5 changed files
with
70 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 5 additions & 11 deletions
16
packages/cli/test/integration/runners/task-runner-process.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 22 additions & 0 deletions
22
packages/cli/test/integration/runners/task-runner-server.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import { setupBrokerTestServer } from '@test-integration/utils/task-broker-test-server'; | ||
|
||
describe('TaskRunnerServer', () => { | ||
const { agent, server } = setupBrokerTestServer({ | ||
authToken: 'token', | ||
mode: 'external', | ||
}); | ||
|
||
beforeAll(async () => { | ||
await server.start(); | ||
}); | ||
|
||
afterAll(async () => { | ||
await server.stop(); | ||
}); | ||
|
||
describe('/healthz', () => { | ||
it('should return 200', async () => { | ||
await agent.get('/healthz').expect(200); | ||
}); | ||
}); | ||
}); |
40 changes: 40 additions & 0 deletions
40
packages/cli/test/integration/shared/utils/task-broker-test-server.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import { TaskRunnersConfig } from '@n8n/config'; | ||
import request from 'supertest'; | ||
import type TestAgent from 'supertest/lib/agent'; | ||
import Container from 'typedi'; | ||
|
||
import { TaskRunnerServer } from '@/runners/task-runner-server'; | ||
|
||
export interface TestTaskBrokerServer { | ||
server: TaskRunnerServer; | ||
agent: TestAgent; | ||
config: TaskRunnersConfig; | ||
} | ||
|
||
/** | ||
* Sets up a Task Broker Server for testing purposes. The server needs | ||
* to be started and stopped manually. | ||
* | ||
* @example | ||
* const { server, agent, config } = setupBrokerTestServer(); | ||
* | ||
* beforeAll(async () => await server.start()); | ||
* afterAll(async () => await server.stop()); | ||
*/ | ||
export const setupBrokerTestServer = ( | ||
config: Partial<TaskRunnersConfig> = {}, | ||
): TestTaskBrokerServer => { | ||
const runnerConfig = Container.get(TaskRunnersConfig); | ||
Object.assign(runnerConfig, config); | ||
runnerConfig.enabled = true; | ||
runnerConfig.port = 0; // Use any port | ||
|
||
const taskRunnerServer = Container.get(TaskRunnerServer); | ||
const agent = request.agent(taskRunnerServer.app); | ||
|
||
return { | ||
server: taskRunnerServer, | ||
agent, | ||
config: runnerConfig, | ||
}; | ||
}; |