test(gateway): harden session event setup timeout · openclaw/openclaw@37cd602
steipete
·
2026-04-27
·
via Recent Commits to openclaw:main
| Original file line number | Diff line number | Diff line change |
|---|
@@ -19,6 +19,7 @@ import {
|
19 | 19 | installGatewayTestHooks({ scope: "suite" }); |
20 | 20 | |
21 | 21 | const cleanupDirs: string[] = []; |
| 22 | +const SETUP_RPC_TIMEOUT_MS = 30_000; |
22 | 23 | let harness: Awaited<ReturnType<typeof createGatewaySuiteHarness>>; |
23 | 24 | let subscribedOperatorWs: |
24 | 25 | | Awaited<ReturnType<Awaited<ReturnType<typeof createGatewaySuiteHarness>>["openWs"]>> |
@@ -30,13 +31,18 @@ beforeAll(async () => {
|
30 | 31 | delete process.env.OPENCLAW_TEST_MINIMAL_GATEWAY; |
31 | 32 | harness = await createGatewaySuiteHarness(); |
32 | 33 | subscribedOperatorWs = await harness.openWs(); |
33 | | -await connectOk(subscribedOperatorWs, { scopes: ["operator.read"] }); |
34 | | -await rpcReq(subscribedOperatorWs, "sessions.subscribe"); |
35 | | -}); |
| 34 | +await connectOk(subscribedOperatorWs, { |
| 35 | +scopes: ["operator.read"], |
| 36 | +timeoutMs: SETUP_RPC_TIMEOUT_MS, |
| 37 | +}); |
| 38 | +await rpcReq(subscribedOperatorWs, "sessions.subscribe", undefined, SETUP_RPC_TIMEOUT_MS); |
| 39 | +}, 60_000); |
36 | 40 | |
37 | 41 | afterAll(async () => { |
38 | 42 | subscribedOperatorWs?.close(); |
39 | | -await harness.close(); |
| 43 | +if (harness) { |
| 44 | +await harness.close(); |
| 45 | +} |
40 | 46 | if (previousMinimalGateway === undefined) { |
41 | 47 | delete process.env.OPENCLAW_TEST_MINIMAL_GATEWAY; |
42 | 48 | } else { |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。