Skip to content

Commit d5ccda8

Browse files
committed
Restore busybox smoke assertion in integration tests
1 parent cf09191 commit d5ccda8

1 file changed

Lines changed: 48 additions & 0 deletions

File tree

test/integration/oci2gondolin.integration.test.ts

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,13 @@ const PLATFORM = resolveIntegrationPlatform(process.env.INTEGRATION_PLATFORM ??
2525
const ROOTFS_CHECK_PATH = process.env.INTEGRATION_ROOTFS_CHECK_PATH ?? "/etc/debian_version";
2626
const VM_CHECK_COMMAND = process.env.INTEGRATION_VM_CHECK_COMMAND ?? "cat /etc/debian_version";
2727
const VM_CHECK_EXPECT = process.env.INTEGRATION_VM_CHECK_EXPECT ?? "12";
28+
const BUSYBOX_IMAGE = process.env.INTEGRATION_BUSYBOX_IMAGE ?? "busybox:latest";
2829

2930
const imageSlug = IMAGE.replace(/[^a-z0-9._-]+/gi, "-").toLowerCase();
3031
const tempRoot = fs.mkdtempSync(path.join(os.tmpdir(), `docker2vm-integration-${imageSlug}-`));
3132
const rootfsOutDir = path.join(tempRoot, `${imageSlug}-rootfs`);
3233
const assetsOutDir = path.join(tempRoot, `${imageSlug}-assets`);
34+
const busyboxAssetsOutDir = path.join(tempRoot, "busybox-assets-smoke");
3335

3436
afterAll(() => {
3537
fs.rmSync(tempRoot, { recursive: true, force: true });
@@ -162,6 +164,52 @@ describe("oci2gondolin integration", () => {
162164
}
163165
}
164166
}, 420_000);
167+
168+
it("keeps the busybox VM smoke check", async () => {
169+
requireBinary(process.arch === "arm64" ? "qemu-system-aarch64" : "qemu-system-x86_64");
170+
171+
const result = await runCommand(
172+
"bun",
173+
[
174+
"run",
175+
"src/bin/oci2gondolin.ts",
176+
"--image",
177+
BUSYBOX_IMAGE,
178+
"--platform",
179+
PLATFORM,
180+
"--mode",
181+
"assets",
182+
"--out",
183+
busyboxAssetsOutDir,
184+
],
185+
{ cwd: REPO_ROOT, timeoutMs: 300_000 },
186+
);
187+
188+
assertSuccess(result, "oci2gondolin busybox assets conversion");
189+
190+
const originalGuestDir = process.env.GONDOLIN_GUEST_DIR;
191+
const vmSandbox = resolveVmSandboxOptions();
192+
193+
let vm: VM | null = null;
194+
try {
195+
process.env.GONDOLIN_GUEST_DIR = busyboxAssetsOutDir;
196+
vm = await VM.create({ sandbox: vmSandbox });
197+
198+
const busyboxResult = await vm.exec(["/bin/busybox", "echo", "integration-busybox-ok"]);
199+
expect(busyboxResult.exitCode).toBe(0);
200+
expect(busyboxResult.stdout).toContain("integration-busybox-ok");
201+
} finally {
202+
await vm?.close().catch(() => {
203+
// ignore close errors in test teardown
204+
});
205+
206+
if (originalGuestDir === undefined) {
207+
delete process.env.GONDOLIN_GUEST_DIR;
208+
} else {
209+
process.env.GONDOLIN_GUEST_DIR = originalGuestDir;
210+
}
211+
}
212+
}, 420_000);
165213
});
166214

167215
function resolveIntegrationPlatform(raw: string): "linux/amd64" | "linux/arm64" {

0 commit comments

Comments
 (0)