@@ -3,11 +3,10 @@ mod docker_tests {
33 use anyhow:: Result ;
44 use std:: path:: Path ;
55 use tempdir:: TempDir ;
6- use tokio:: runtime:: Runtime ;
76 use uuid:: Uuid ;
87
98 use rfs:: fungi;
10- use rfs:: store:: { self , dir:: DirStore } ;
9+ use rfs:: store:: dir:: DirStore ;
1110 use rfs:: DockerImageToFlist ;
1211
1312 #[ test]
@@ -18,42 +17,55 @@ mod docker_tests {
1817 return Ok ( ( ) ) ;
1918 }
2019
21- // Create a runtime for async operations
22- let rt = Runtime :: new ( ) ?;
20+ // Run the test on a thread with larger stack size to avoid stack overflow
21+ let handle = std:: thread:: Builder :: new ( )
22+ . stack_size ( 16 * 1024 * 1024 ) // 16MB stack size
23+ . spawn ( move || -> Result < ( ) > {
24+ // Create a custom runtime with timers and IO enabled
25+ let rt = tokio:: runtime:: Builder :: new_multi_thread ( )
26+ . worker_threads ( 2 )
27+ . enable_time ( )
28+ . enable_io ( )
29+ . build ( )
30+ . unwrap ( ) ;
2331
24- rt. block_on ( async {
25- // Create temporary directories
26- let temp_dir = TempDir :: new ( "docker-test" ) ?;
27- let store_dir = temp_dir. path ( ) . join ( "store" ) ;
28- std:: fs:: create_dir_all ( & store_dir) ?;
32+ rt. block_on ( async {
33+ // Create temporary directories
34+ let temp_dir = TempDir :: new ( "docker-test" ) ?;
35+ let store_dir = temp_dir. path ( ) . join ( "store" ) ;
36+ std:: fs:: create_dir_all ( & store_dir) ?;
2937
30- // Create a store
31- let store = DirStore :: new ( & store_dir) . await ?;
38+ // Create a store
39+ let store = DirStore :: new ( & store_dir) . await ?;
3240
33- // Create a flist writer
34- let fl_path = temp_dir. path ( ) . join ( "alpine-test.fl" ) ;
35- let meta = fungi:: Writer :: new ( & fl_path, true ) . await ?;
41+ // Create a flist writer
42+ let fl_path = temp_dir. path ( ) . join ( "alpine-test.fl" ) ;
43+ let meta = fungi:: Writer :: new ( & fl_path, true ) . await ?;
3644
37- // Create a temporary directory for docker extraction
38- let container_name = Uuid :: new_v4 ( ) . to_string ( ) ;
39- let docker_tmp_dir = TempDir :: new ( & container_name) ?;
45+ // Create a temporary directory for docker extraction
46+ let container_name = Uuid :: new_v4 ( ) . to_string ( ) ;
47+ let docker_tmp_dir = TempDir :: new ( & container_name) ?;
4048
41- // Create DockerImageToFlist instance
42- let mut docker_to_fl = DockerImageToFlist :: new (
43- meta,
44- "alpine:latest" . to_string ( ) ,
45- None , // No credentials for public image
46- docker_tmp_dir,
47- ) ;
49+ // Create DockerImageToFlist instance
50+ let mut docker_to_fl = DockerImageToFlist :: new (
51+ meta,
52+ "alpine:latest" . to_string ( ) ,
53+ None , // No credentials for public image
54+ docker_tmp_dir,
55+ ) ;
4856
49- // Convert docker image to flist
50- docker_to_fl. convert ( store, None ) . await ?;
57+ // Convert docker image to flist
58+ docker_to_fl. convert ( store, None ) . await ?;
5159
52- // Verify the flist was created
53- assert ! ( Path :: new( & fl_path) . exists( ) , "Flist file was not created" ) ;
60+ // Verify the flist was created
61+ assert ! ( Path :: new( & fl_path) . exists( ) , "Flist file was not created" ) ;
5462
55- Ok ( ( ) )
56- } )
63+ Ok ( ( ) )
64+ } )
65+ } )
66+ . unwrap ( ) ;
67+
68+ handle. join ( ) . unwrap ( )
5769 }
5870
5971 // Helper function to check if docker is available
0 commit comments