26 lines
1013 B
TypeScript
26 lines
1013 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 aggregates two CraftOS computers from the same headless process", async () => {
|
|
const bridge = await startBridge();
|
|
const craftos = startCraftos("multi-echo-client.lua", { shellArgs: [bridge.linkUrl], timeoutMs: 15_000 });
|
|
try {
|
|
await waitForComputers(bridge.registry, 2, 12_000);
|
|
const text = await callProbeComputers(bridge.mcpUrl);
|
|
const lines = text.split("\n").sort();
|
|
assert.deepEqual(lines, [
|
|
"pong from 1001 (Label: echo-A)",
|
|
"pong from 1002 (Label: echo-B)",
|
|
]);
|
|
} 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();
|
|
}
|
|
});
|