Merge pull request 'Run multi-target commands in parallel' (#75) from parallel-targets into main
CI / UI screenshots (before/after) (push) Skipped
CI / Test (jest) (push) Successful in 20s
CI / Lint (eslint) (push) Successful in 29s
CI / Security (npm audit) (push) Successful in 15s
CI / Scan (secrets, workflows, shell) (push) Successful in 2m1s
CI / Integration (api) (push) Successful in 2m50s
CI / UI (playwright) (push) Successful in 1m56s
CI / Deploy (push) Successful in 14s
CI / Deploy worker (push) Successful in 8s
CI / Notify (push) Successful in 3s

This commit was merged in pull request #75.
This commit is contained in:
jared committed 2026-11-23 13:15:17 -05:00
commit a945cd80d3
4 files changed
+63 -33

No files matched your search

+29
View File
@@ -227,3 +227,32 @@ test('the execution list marks runs waiting on a prompt (#3)', async () => {
await waitForExecution(id);
expect((await row()).waiting_for_input).toBe(false);
});
test('a step runs on all its targets at once (#26)', async () => {
const t0 = Date.now();
const ex = await waitForExecution(await start(await createWorkflow([
{ id: 'slow', type: 'execute', command: 'sleep 2; echo done', targets: ['all'] },
])));
expect(ex.status).toBe('completed');
expect(outputs(ex).filter(o => o === 'done')).toHaveLength(3);
expect(Date.now() - t0).toBeLessThan(5500); // in sequence it would take 6 s or more
});
test('parallel: false runs the targets one after another (#26)', async () => {
const t0 = Date.now();
const ex = await waitForExecution(await start(await createWorkflow([
{ id: 'slow', type: 'execute', command: 'sleep 2; echo done', targets: ['all'], parallel: false },
])), { timeout: 30_000 });
expect(ex.status).toBe('completed');
expect(Date.now() - t0).toBeGreaterThanOrEqual(6000);
});
test('a failure on one target fails the step, after every target has reported (#26)', async () => {
const ex = await waitForExecution(await start(await createWorkflow([
{ id: 'one-bad', type: 'execute', command: 'test "$WORKER_NAME" != node-02 && echo ok', targets: ['all'] },
{ id: 'after', type: 'execute', command: 'echo should-not-run', targets: ['node-01'] },
])));
expect(ex.status).toBe('failed');
expect(outputs(ex).filter(o => o === 'ok')).toHaveLength(2);
expect(outputs(ex)).not.toContain('should-not-run');
});