36 lines
1.0 KiB
TypeScript
36 lines
1.0 KiB
TypeScript
import { execFileSync } from "node:child_process";
|
|
import path from "node:path";
|
|
import { fileURLToPath } from "node:url";
|
|
import { describe, expect, it } from "vitest";
|
|
|
|
const script = path.join(
|
|
path.dirname(fileURLToPath(import.meta.url)),
|
|
"../../../infra/sandboxes/computer/computer-image-tools.test.sh",
|
|
);
|
|
|
|
function dockerImagePresent(image: string): boolean {
|
|
try {
|
|
execFileSync("docker", ["image", "inspect", image], { stdio: "ignore" });
|
|
return true;
|
|
} catch {
|
|
return false;
|
|
}
|
|
}
|
|
|
|
describe("rakazo/computer image tooling", () => {
|
|
it("includes git, gh, ssh, curl, and sudo when the image is built locally", () => {
|
|
if (process.env.RAKAZO_COMPUTER_IMAGE_TOOLS_TEST !== "1") {
|
|
return;
|
|
}
|
|
const image = process.env.RAKAZO_COMPUTER_IMAGE ?? "rakazo/computer:local";
|
|
if (!dockerImagePresent(image)) {
|
|
return;
|
|
}
|
|
execFileSync("bash", [script], {
|
|
env: { ...process.env, RAKAZO_COMPUTER_IMAGE: image },
|
|
stdio: "inherit",
|
|
});
|
|
expect(true).toBe(true);
|
|
});
|
|
});
|