test(gateway): harden session event setup timeout

This commit is contained in:
Peter Steinberger
2026-04-27 08:11:05 +01:00
parent d1a8e2b17c
commit 37cd6027cf

View File

@@ -19,6 +19,7 @@ import {
installGatewayTestHooks({ scope: "suite" });
const cleanupDirs: string[] = [];
const SETUP_RPC_TIMEOUT_MS = 30_000;
let harness: Awaited<ReturnType<typeof createGatewaySuiteHarness>>;
let subscribedOperatorWs:
| Awaited<ReturnType<Awaited<ReturnType<typeof createGatewaySuiteHarness>>["openWs"]>>
@@ -30,13 +31,18 @@ beforeAll(async () => {
delete process.env.OPENCLAW_TEST_MINIMAL_GATEWAY;
harness = await createGatewaySuiteHarness();
subscribedOperatorWs = await harness.openWs();
await connectOk(subscribedOperatorWs, { scopes: ["operator.read"] });
await rpcReq(subscribedOperatorWs, "sessions.subscribe");
});
await connectOk(subscribedOperatorWs, {
scopes: ["operator.read"],
timeoutMs: SETUP_RPC_TIMEOUT_MS,
});
await rpcReq(subscribedOperatorWs, "sessions.subscribe", undefined, SETUP_RPC_TIMEOUT_MS);
}, 60_000);
afterAll(async () => {
subscribedOperatorWs?.close();
await harness.close();
if (harness) {
await harness.close();
}
if (previousMinimalGateway === undefined) {
delete process.env.OPENCLAW_TEST_MINIMAL_GATEWAY;
} else {