test: Add task runner to test containers (#19254)

This commit is contained in:
shortstacked
2025-09-08 09:48:58 +01:00
committed by GitHub
parent 56f4069325
commit b166445275
7 changed files with 145 additions and 17 deletions

View File

@@ -351,5 +351,44 @@ export async function setupProxyServer({
}
}
const TASK_RUNNER_IMAGE = 'n8nio/runners:nightly';
export async function setupTaskRunner({
projectName,
network,
taskBrokerUri,
}: {
projectName: string;
network: StartedNetwork;
taskBrokerUri: string;
}): Promise<StartedTestContainer> {
const { consumer, throwWithLogs } = createSilentLogConsumer();
try {
return await new GenericContainer(TASK_RUNNER_IMAGE)
.withNetwork(network)
.withNetworkAliases(`${projectName}-task-runner`)
.withExposedPorts(5680)
.withEnvironment({
N8N_RUNNERS_AUTH_TOKEN: 'test',
N8N_RUNNERS_LAUNCHER_LOG_LEVEL: 'debug',
N8N_RUNNERS_TASK_BROKER_URI: taskBrokerUri,
N8N_RUNNERS_MAX_CONCURRENCY: '5',
N8N_RUNNERS_AUTO_SHUTDOWN_TIMEOUT: '15',
})
.withWaitStrategy(Wait.forListeningPorts())
.withLabels({
'com.docker.compose.project': projectName,
'com.docker.compose.service': 'task-runner',
})
.withName(`${projectName}-task-runner`)
.withReuse()
.withLogConsumer(consumer)
.start();
} catch (error) {
return throwWithLogs(error);
}
}
// TODO: Look at Ollama container?
// TODO: Look at MariaDB container?