- #6: a quick command to a disconnected worker is refused before an execution is recorded, instead of leaving one stuck in 'running'. - #21: an unanswered prompt fails the execution (prompt_timeout) instead of continuing as if someone had chosen; prompt and wait steps never wait past the execution's deadline, and a wait cut short by it fails with execution_timeout. PULSE_PROMPT_TIMEOUT_MS (minimum 1 s, default 60 min) lets the test stack use 8 s. - #34: deleting a connected worker is a 409 explaining it would re-register on its next heartbeat; offline workers delete as before. Tests for each (integration 45/45). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
073114c92e
commit
d517cae7e6
4 files changed
+85
-11
No files matched your search
@@ -90,3 +90,29 @@ test('aborting a command kills its process on the worker (#8)', async () => {
|
||||
expect((await waitForExecution(id)).status).toBe('failed');
|
||||
} finally { await w.stop(); }
|
||||
});
|
||||
|
||||
test('a quick command to an offline worker is refused without leaving a running execution (#6)', async () => {
|
||||
const mysql = require('mysql2/promise');
|
||||
const marker = `offline-${unique()}`;
|
||||
const w = await startWorker(unique());
|
||||
w.child.kill('SIGKILL');
|
||||
try {
|
||||
await waitFor(async () => (await sso('POST', `/api/workers/${w.id}/command`, { command: `echo ${marker}` })).status === 400,
|
||||
{ timeout: 5000, what: 'the server to notice the worker is gone' });
|
||||
const db = await mysql.createConnection({
|
||||
host: process.env.DB_HOST || '127.0.0.1', port: Number(process.env.DB_PORT || 3306),
|
||||
user: process.env.DB_USER || 'pulse', password: process.env.DB_PASSWORD || 'ci-only', database: process.env.DB_NAME || 'pulse',
|
||||
});
|
||||
try {
|
||||
const [rows] = await db.query('SELECT id FROM executions WHERE logs LIKE ?', [`%${marker}%`]);
|
||||
expect(rows).toEqual([]);
|
||||
} finally { await db.end(); }
|
||||
} finally { await w.stop(); }
|
||||
});
|
||||
|
||||
test('a connected worker cannot be deleted; it would re-register on its next heartbeat (#34)', async () => {
|
||||
const node1 = await workerByName('node-01');
|
||||
const r = await sso('DELETE', `/api/workers/${node1.id}`);
|
||||
expect(r.status).toBe(409);
|
||||
expect((await workerByName('node-01'))?.id).toBe(node1.id);
|
||||
});
|
||||
@@ -204,3 +204,15 @@ test('abort during a long command stops the workflow at once, without waiting fo
|
||||
expect(logs(ex, 'step_started').map(l => l.step)).toEqual([1]);
|
||||
expect(Date.now() - t0).toBeLessThan(10_000);
|
||||
});
|
||||
|
||||
test('an unanswered prompt fails the execution instead of continuing (#21)', async () => {
|
||||
// The test stack sets PULSE_PROMPT_TIMEOUT_MS=8000.
|
||||
const id = await start(await createWorkflow([
|
||||
{ id: 'ask', type: 'prompt', message: 'Anyone there?', options: ['Yes'] },
|
||||
{ id: 'after', type: 'execute', command: 'echo continued', targets: ['node-01'] },
|
||||
]));
|
||||
const ex = await waitForExecution(id, { timeout: 20_000 });
|
||||
expect(ex.status).toBe('failed');
|
||||
expect(logs(ex, 'prompt_timeout')).toHaveLength(1);
|
||||
expect(outputs(ex)).toEqual([]);
|
||||
});
|
||||
Reference in new issue
Block a user