22 lines
874 B
TypeScript
22 lines
874 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 a single CraftOS echo computer", async () => {
|
|
const bridge = await startBridge();
|
|
const craftos = startCraftos("echo-client.lua", { shellArgs: ["1", "echo-1", "ws://127.0.0.1:2001", "8"] });
|
|
try {
|
|
await waitForComputers(bridge.registry, 1, 12_000);
|
|
const text = await callProbeComputers();
|
|
assert.equal(text, "pong from 1 (Label: echo-1)");
|
|
} 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();
|
|
}
|
|
});
|