mirror of
https://github.com/openclaw/openclaw.git
synced 2026-08-08 11:02:26 +00:00
fix(e2e): require kitchen sink ready body
This commit is contained in:
@@ -994,10 +994,10 @@ export async function waitForGatewayReady(child, port, logPath, options = {}) {
|
||||
throw outcome.error;
|
||||
}
|
||||
const readyz = outcome.readyz;
|
||||
if (readyz.ok) {
|
||||
if (readyz.ok && readyz.body?.ready === true) {
|
||||
return;
|
||||
}
|
||||
lastError = `/readyz HTTP ${readyz.status}`;
|
||||
lastError = `/readyz HTTP ${readyz.status} body=${JSON.stringify(readyz.body)}`;
|
||||
} catch (error) {
|
||||
lastError = error instanceof Error ? error.message : String(error);
|
||||
}
|
||||
|
||||
@@ -302,6 +302,30 @@ describe("kitchen-sink RPC gateway teardown", () => {
|
||||
rmSync(root, { recursive: true, force: true });
|
||||
}
|
||||
});
|
||||
|
||||
it("requires /readyz body.ready before accepting gateway readiness", async () => {
|
||||
const root = mkdtempSync(path.join(tmpdir(), "openclaw-kitchen-rpc-ready-body-"));
|
||||
try {
|
||||
const logPath = path.join(root, "gateway.log");
|
||||
writeFileSync(logPath, "[gateway] ready\n");
|
||||
const fetchImpl = vi
|
||||
.fn()
|
||||
.mockResolvedValueOnce(new Response('{"ready":false}', { status: 200 }))
|
||||
.mockResolvedValueOnce(new Response('{"ready":true}', { status: 200 }));
|
||||
|
||||
await expect(
|
||||
waitForGatewayReady({ exitCode: null, signalCode: null }, 9, logPath, {
|
||||
fetchImpl,
|
||||
pollDelayMs: 1,
|
||||
timeoutMs: 100,
|
||||
}),
|
||||
).resolves.toBeUndefined();
|
||||
|
||||
expect(fetchImpl).toHaveBeenCalledTimes(2);
|
||||
} finally {
|
||||
rmSync(root, { recursive: true, force: true });
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
describe("kitchen-sink RPC gateway readiness logs", () => {
|
||||
|
||||
Reference in New Issue
Block a user