mirror of
https://github.com/openclaw/openclaw.git
synced 2026-08-05 01:21:15 +00:00
fix(qa-lab): prevent Telegram desktop API hangs (#107699)
This commit is contained in:
@@ -119,6 +119,13 @@ describe("mantis Telegram desktop builder runtime", () => {
|
||||
expect(remoteScript).toContain("openclaw gateway run");
|
||||
expect(remoteScript).toContain("telegram-ready-message.json");
|
||||
expect(remoteScript).toContain("telegram-desktop-builder.mp4");
|
||||
expect(remoteScript).toContain(
|
||||
"const response = await fetch(`https://api.telegram.org/bot${token}/getMe`, {\n signal: AbortSignal.timeout(15_000),\n});",
|
||||
);
|
||||
expect(remoteScript).toContain(
|
||||
'const response = await fetch(`https://api.telegram.org/bot${token}/sendMessage`, {\n method: "POST",\n headers: { "content-type": "application/json" },\n body: JSON.stringify({ chat_id: chatId, text, disable_notification: true }),\n signal: AbortSignal.timeout(15_000),\n});',
|
||||
);
|
||||
expect(remoteScript?.match(/signal: AbortSignal\.timeout\(15_000\)/gu)?.length).toBe(2);
|
||||
expect(
|
||||
commands.some((entry) => entry.command === "/tmp/crabbox" && entry.args[0] === "stop"),
|
||||
).toBe(false);
|
||||
|
||||
@@ -397,7 +397,9 @@ qa_status=0
|
||||
fi
|
||||
driver_user_id="$(node --input-type=module >"$out/telegram-driver-getme.json" 2>"$out/telegram-driver-getme.err" <<'MANTIS_TELEGRAM_GETME'
|
||||
const token = process.env.OPENCLAW_MANTIS_TELEGRAM_DRIVER_BOT_TOKEN;
|
||||
const response = await fetch(\`https://api.telegram.org/bot\${token}/getMe\`);
|
||||
const response = await fetch(\`https://api.telegram.org/bot\${token}/getMe\`, {
|
||||
signal: AbortSignal.timeout(15_000),
|
||||
});
|
||||
const body = await response.json();
|
||||
process.stdout.write(JSON.stringify({ ok: body.ok, id: body.result?.id, username: body.result?.username }));
|
||||
if (!body.ok || !body.result?.id) process.exit(1);
|
||||
@@ -438,6 +440,7 @@ const response = await fetch(\`https://api.telegram.org/bot\${token}/sendMessage
|
||||
method: "POST",
|
||||
headers: { "content-type": "application/json" },
|
||||
body: JSON.stringify({ chat_id: chatId, text, disable_notification: true }),
|
||||
signal: AbortSignal.timeout(15_000),
|
||||
});
|
||||
const body = await response.json();
|
||||
process.stdout.write(JSON.stringify({ ok: body.ok, message_id: body.result?.message_id }));
|
||||
|
||||
Reference in New Issue
Block a user