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

@@ -3,7 +3,14 @@ import type { N8NConfig } from 'n8n-containers/n8n-test-container-creation';
// Tags that require test containers environment
// These tests won't be run against local
const CONTAINER_ONLY_TAGS = ['proxy', 'multi-node', 'postgres', 'queue', 'multi-main'];
const CONTAINER_ONLY_TAGS = [
'proxy',
'multi-node',
'postgres',
'queue',
'multi-main',
'task-runner',
];
const CONTAINER_ONLY = new RegExp(`@capability:(${CONTAINER_ONLY_TAGS.join('|')})`);
// Tags that need serial execution
@@ -11,11 +18,8 @@ const CONTAINER_ONLY = new RegExp(`@capability:(${CONTAINER_ONLY_TAGS.join('|')}
// In local run they are a "dependency" which means they will be skipped if earlier tests fail, not ideal but needed for isolation
const SERIAL_EXECUTION = /@db:reset/;
// Tags that require proxy server
const REQUIRES_PROXY_SERVER = /@capability:proxy/;
const CONTAINER_CONFIGS: Array<{ name: string; config: N8NConfig }> = [
{ name: 'standard', config: { proxyServerEnabled: true } },
{ name: 'standard', config: { proxyServerEnabled: true, taskRunner: true } },
{ name: 'postgres', config: { postgres: true } },
{ name: 'queue', config: { queueMode: true } },
{ name: 'multi-main', config: { queueMode: { mains: 2, workers: 1 } } },
@@ -38,7 +42,6 @@ export function getProjects(): Project[] {
name: 'ui:isolated',
testDir: './tests/ui',
grep: SERIAL_EXECUTION,
grepInvert: REQUIRES_PROXY_SERVER,
workers: 1,
use: { baseURL: process.env.N8N_BASE_URL },
},
@@ -46,10 +49,6 @@ export function getProjects(): Project[] {
} else {
for (const { name, config } of CONTAINER_CONFIGS) {
const grepInvertPatterns = [SERIAL_EXECUTION.source];
if (!config.proxyServerEnabled) {
grepInvertPatterns.push(REQUIRES_PROXY_SERVER.source);
}
projects.push(
{
name: `${name}:ui`,
@@ -63,7 +62,6 @@ export function getProjects(): Project[] {
name: `${name}:ui:isolated`,
testDir: './tests/ui',
grep: SERIAL_EXECUTION,
grepInvert: !config.proxyServerEnabled ? REQUIRES_PROXY_SERVER : undefined,
workers: 1,
use: { containerConfig: config },
},