mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-09 22:44:31 +00:00
perf(test): tighten background-abort e2e wait
This commit is contained in:
@@ -1,5 +1,4 @@
|
|||||||
import { afterEach, expect, test } from "vitest";
|
import { afterEach, expect, test } from "vitest";
|
||||||
import { sleep } from "../utils.ts";
|
|
||||||
import {
|
import {
|
||||||
getFinishedSession,
|
getFinishedSession,
|
||||||
getSession,
|
getSession,
|
||||||
@@ -52,7 +51,17 @@ async function expectBackgroundSessionSurvivesAbort(params: {
|
|||||||
const sessionId = (result.details as { sessionId: string }).sessionId;
|
const sessionId = (result.details as { sessionId: string }).sessionId;
|
||||||
|
|
||||||
abortController.abort();
|
abortController.abort();
|
||||||
await sleep(150);
|
const startedAt = Date.now();
|
||||||
|
await expect
|
||||||
|
.poll(
|
||||||
|
() => {
|
||||||
|
const running = getSession(sessionId);
|
||||||
|
const finished = getFinishedSession(sessionId);
|
||||||
|
return Date.now() - startedAt >= 100 && !finished && running?.exited === false;
|
||||||
|
},
|
||||||
|
{ timeout: process.platform === "win32" ? 1_500 : 800, interval: 20 },
|
||||||
|
)
|
||||||
|
.toBe(true);
|
||||||
|
|
||||||
const running = getSession(sessionId);
|
const running = getSession(sessionId);
|
||||||
const finished = getFinishedSession(sessionId);
|
const finished = getFinishedSession(sessionId);
|
||||||
|
|||||||
Reference in New Issue
Block a user