mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-08 03:41:22 +00:00
perf(test): reduce hot-suite setup and duplicate test work
This commit is contained in:
@@ -15,22 +15,22 @@ describe("waitForTransportReady", () => {
|
||||
let attempts = 0;
|
||||
const readyPromise = waitForTransportReady({
|
||||
label: "test transport",
|
||||
timeoutMs: 500,
|
||||
logAfterMs: 120,
|
||||
logIntervalMs: 100,
|
||||
pollIntervalMs: 80,
|
||||
timeoutMs: 220,
|
||||
logAfterMs: 60,
|
||||
logIntervalMs: 1_000,
|
||||
pollIntervalMs: 50,
|
||||
runtime,
|
||||
check: async () => {
|
||||
attempts += 1;
|
||||
if (attempts > 4) {
|
||||
if (attempts > 2) {
|
||||
return { ok: true };
|
||||
}
|
||||
return { ok: false, error: "not ready" };
|
||||
},
|
||||
});
|
||||
|
||||
for (let i = 0; i < 5; i += 1) {
|
||||
await vi.advanceTimersByTimeAsync(80);
|
||||
for (let i = 0; i < 3; i += 1) {
|
||||
await vi.advanceTimersByTimeAsync(50);
|
||||
}
|
||||
|
||||
await readyPromise;
|
||||
@@ -41,14 +41,14 @@ describe("waitForTransportReady", () => {
|
||||
const runtime = { log: vi.fn(), error: vi.fn(), exit: vi.fn() };
|
||||
const waitPromise = waitForTransportReady({
|
||||
label: "test transport",
|
||||
timeoutMs: 200,
|
||||
timeoutMs: 110,
|
||||
logAfterMs: 0,
|
||||
logIntervalMs: 100,
|
||||
logIntervalMs: 1_000,
|
||||
pollIntervalMs: 50,
|
||||
runtime,
|
||||
check: async () => ({ ok: false, error: "still down" }),
|
||||
});
|
||||
await vi.advanceTimersByTimeAsync(250);
|
||||
await vi.advanceTimersByTimeAsync(200);
|
||||
await expect(waitPromise).rejects.toThrow("test transport not ready");
|
||||
expect(runtime.error).toHaveBeenCalled();
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user