n8n/packages/testing/playwright/tests/multimain.spec.ts
shortstacked 852657c17e
feat: Add testcontainers and Playwright (no-changelog) (#16662)
Co-authored-by: Tomi Turtiainen <10324676+tomi@users.noreply.github.com>
2025-07-01 14:15:31 +01:00

23 lines
609 B
TypeScript

import { test, expect } from '../fixtures/base';
test('Leader election @mode:multi-main @chaostest', async ({ chaos }) => {
// First get the container (try main 1 first)
const namePattern = 'n8n-main-*';
const findContainerByLog = await chaos.waitForLog('Leader is now this', {
namePattern,
});
expect(findContainerByLog).toBeDefined();
const currentLeader = findContainerByLog.containerName;
// Stop leader
await chaos.stopContainer(currentLeader);
// Find new leader
const newLeader = await chaos.waitForLog('Leader is now this', {
namePattern,
});
expect(newLeader).toBeDefined();
});