cc-libs/tools/mcp-bridge/test-integration/probe-silent.test.ts

22 lines
881 B
TypeScript

import assert from "node:assert/strict";
import test from "node:test";
import { callProbeComputers, formatFailure, startBridge, startCraftos, waitForComputers } from "./harness.js";
test("probe-computers reports timeout for a connected computer that never replies", async () => {
const bridge = await startBridge(300);
const craftos = startCraftos("silent-client.lua", { shellArgs: ["7", "silent-7", "8"] });
try {
await waitForComputers(bridge.registry, 1, 12_000);
const text = await callProbeComputers();
assert.equal(text, "timeout from 7 (Label: silent-7)");
} catch (error) {
craftos.abort();
const result = await craftos.done;
throw new Error(formatFailure(error instanceof Error ? error.message : String(error), result.output), { cause: error });
} finally {
craftos.abort();
await craftos.done;
await bridge.close();
}
});