fix(qa): settle restart races with live budget · openclaw/openclaw@2cac9e5
vincentkoc
·
2026-05-25
·
via Recent Commits to openclaw:main
| Original file line number | Diff line number | Diff line change |
|---|
@@ -189,6 +189,34 @@ describe("qa suite gateway helpers", () => {
|
189 | 189 | expect(waitReady.mock.calls[0]?.[0].timeoutMs).toBeGreaterThan(60_000); |
190 | 190 | }); |
191 | 191 | |
| 192 | +it("uses the live timeout profile when config mutation races a restart", async () => { |
| 193 | +const release = vi.fn(async () => {}); |
| 194 | +fetchWithSsrFGuardMock.mockResolvedValue({ |
| 195 | +response: { ok: true }, |
| 196 | + release, |
| 197 | +}); |
| 198 | +const gatewayCall = vi.fn(async (method: string) => { |
| 199 | +if (method === "config.get") { |
| 200 | +return { hash: "hash-1", config: { tools: {} } }; |
| 201 | +} |
| 202 | +throw new Error("service restart"); |
| 203 | +}); |
| 204 | +const { env, waitReady } = createConfigMutationEnv(gatewayCall); |
| 205 | + |
| 206 | +const result = await patchConfig({ |
| 207 | + env, |
| 208 | +patch: { tools: { deny: ["read"] } }, |
| 209 | +restartDelayMs: 0, |
| 210 | +}); |
| 211 | + |
| 212 | +expect(result).toEqual({ ok: true, restarted: true }); |
| 213 | +expect(waitReady).toHaveBeenCalledWith({ |
| 214 | +gateway: env.gateway, |
| 215 | +timeoutMs: expect.any(Number), |
| 216 | +}); |
| 217 | +expect(waitReady.mock.calls[0]?.[0].timeoutMs).toBeGreaterThan(60_000); |
| 218 | +}); |
| 219 | + |
192 | 220 | it("waits for transport readiness after gateway restart health", async () => { |
193 | 221 | const release = vi.fn(async () => {}); |
194 | 222 | fetchWithSsrFGuardMock.mockResolvedValue({ |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。