@@ -22,17 +22,21 @@ type CommandOptions = {
2222const REPO_ROOT = process . cwd ( ) ;
2323const IMAGE = process . env . INTEGRATION_IMAGE ?? "busybox:latest" ;
2424const PLATFORM = resolveIntegrationPlatform ( process . env . INTEGRATION_PLATFORM ?? process . arch ) ;
25+ const ROOTFS_CHECK_PATH = process . env . INTEGRATION_ROOTFS_CHECK_PATH ?? "/bin/sh" ;
26+ const VM_CHECK_COMMAND = process . env . INTEGRATION_VM_CHECK_COMMAND ?? "echo integration-vm-ok" ;
27+ const VM_CHECK_EXPECT = process . env . INTEGRATION_VM_CHECK_EXPECT ?? "integration-vm-ok" ;
2528
26- const tempRoot = fs . mkdtempSync ( path . join ( os . tmpdir ( ) , "docker2vm-integration-" ) ) ;
27- const rootfsOutDir = path . join ( tempRoot , "busybox-rootfs" ) ;
28- const assetsOutDir = path . join ( tempRoot , "busybox-assets" ) ;
29+ const imageSlug = IMAGE . replace ( / [ ^ a - z 0 - 9 . _ - ] + / gi, "-" ) . toLowerCase ( ) ;
30+ const tempRoot = fs . mkdtempSync ( path . join ( os . tmpdir ( ) , `docker2vm-integration-${ imageSlug } -` ) ) ;
31+ const rootfsOutDir = path . join ( tempRoot , `${ imageSlug } -rootfs` ) ;
32+ const assetsOutDir = path . join ( tempRoot , `${ imageSlug } -assets` ) ;
2933
3034afterAll ( ( ) => {
3135 fs . rmSync ( tempRoot , { recursive : true , force : true } ) ;
3236} ) ;
3337
3438describe ( "oci2gondolin integration" , ( ) => {
35- it ( " materializes a busybox rootfs image" , async ( ) => {
39+ it ( ` materializes a rootfs image for ${ IMAGE } ` , async ( ) => {
3640 const debugfsBinary = requireBinary ( "debugfs" , [
3741 "/opt/homebrew/opt/e2fsprogs/sbin/debugfs" ,
3842 "/usr/local/opt/e2fsprogs/sbin/debugfs" ,
@@ -52,7 +56,7 @@ describe("oci2gondolin integration", () => {
5256 "--out" ,
5357 rootfsOutDir ,
5458 ] ,
55- { cwd : REPO_ROOT , timeoutMs : 180_000 } ,
59+ { cwd : REPO_ROOT , timeoutMs : 300_000 } ,
5660 ) ;
5761
5862 assertSuccess ( result , "oci2gondolin rootfs conversion" ) ;
@@ -76,16 +80,16 @@ describe("oci2gondolin integration", () => {
7680
7781 const debugfsResult = await runCommand (
7882 debugfsBinary ,
79- [ "-R" , " stat /bin/busybox" , rootfsPath ] ,
83+ [ "-R" , ` stat ${ ROOTFS_CHECK_PATH } ` , rootfsPath ] ,
8084 { timeoutMs : 30_000 } ,
8185 ) ;
8286
83- assertSuccess ( debugfsResult , " debugfs stat /bin/busybox" ) ;
87+ assertSuccess ( debugfsResult , ` debugfs stat ${ ROOTFS_CHECK_PATH } ` ) ;
8488 const debugText = `${ debugfsResult . stdout } \n${ debugfsResult . stderr } ` . toLowerCase ( ) ;
8589 expect ( debugText ) . not . toContain ( "file not found by ext2_lookup" ) ;
86- } , 240_000 ) ;
90+ } , 420_000 ) ;
8791
88- it ( " materializes busybox assets and executes inside a VM" , async ( ) => {
92+ it ( ` materializes assets for ${ IMAGE } and executes inside a VM` , async ( ) => {
8993 requireBinary ( process . arch === "arm64" ? "qemu-system-aarch64" : "qemu-system-x86_64" ) ;
9094
9195 const result = await runCommand (
@@ -102,7 +106,7 @@ describe("oci2gondolin integration", () => {
102106 "--out" ,
103107 assetsOutDir ,
104108 ] ,
105- { cwd : REPO_ROOT , timeoutMs : 180_000 } ,
109+ { cwd : REPO_ROOT , timeoutMs : 300_000 } ,
106110 ) ;
107111
108112 assertSuccess ( result , "oci2gondolin assets conversion" ) ;
@@ -141,9 +145,9 @@ describe("oci2gondolin integration", () => {
141145 process . env . GONDOLIN_GUEST_DIR = assetsOutDir ;
142146 vm = await VM . create ( { sandbox : vmSandbox } ) ;
143147
144- const execResult = await vm . exec ( [ "/bin/busybox " , "echo " , "integration-vm-ok" ] ) ;
148+ const execResult = await vm . exec ( [ "/bin/sh " , "-lc " , VM_CHECK_COMMAND ] ) ;
145149 expect ( execResult . exitCode ) . toBe ( 0 ) ;
146- expect ( execResult . stdout ) . toContain ( "integration-vm-ok" ) ;
150+ expect ( execResult . stdout ) . toContain ( VM_CHECK_EXPECT ) ;
147151 } finally {
148152 await vm ?. close ( ) . catch ( ( ) => {
149153 // ignore close errors in test teardown
@@ -155,7 +159,7 @@ describe("oci2gondolin integration", () => {
155159 process . env . GONDOLIN_GUEST_DIR = originalGuestDir ;
156160 }
157161 }
158- } , 300_000 ) ;
162+ } , 420_000 ) ;
159163} ) ;
160164
161165function resolveIntegrationPlatform ( raw : string ) : "linux/amd64" | "linux/arm64" {
0 commit comments