test(server): wait for engine run completion in E3 instead of asserting immediately
The business row settles before the engine marks the workflow completed; under CI load the window is a few hundred ms and the direct assertion flaked. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
1 parent
effaa32b70
commit
9e6ff33ef4
1 file changed
+10
-2
@@ -62,8 +62,16 @@ describe.skipIf(!hasPg)("E3 关闭聊天不影响后台", () => {
|
||||
);
|
||||
expect(run.finished_at).not.toBeNull();
|
||||
expect(run.summary).toContain("已入库 1 个");
|
||||
const engineRun = await e.booted.ctx.engine.get(task.engine_run_id!);
|
||||
expect(engineRun?.status).toBe("completed");
|
||||
// 业务表先落终态,引擎在最后一步返回后才把 run 标 completed:给这个窗口留时间(负载高时会有几百毫秒)
|
||||
const engineRun = await waitFor(
|
||||
async () => {
|
||||
const r = await e.booted.ctx.engine.get(task.engine_run_id!);
|
||||
return r?.status === "completed" ? r : null;
|
||||
},
|
||||
15_000,
|
||||
"engine run completed",
|
||||
);
|
||||
expect(engineRun.status).toBe("completed");
|
||||
const t = await e.db.selectFrom("task").select("status").where("id", "=", task.id).executeTakeFirstOrThrow();
|
||||
expect(t.status).toBe("succeeded");
|
||||
const slot = await e.db
|
||||
|
||||
Reference in new issue
Block a user