5252 <P as ProviderFactory >:: ProviderMut : ProviderRW ,
5353{
5454 node : LaunchedNode < P > ,
55+ /// Temp directory holding a copied database snapshot. Cleaned up on drop.
56+ _db_temp_dir : Option < tempfile:: TempDir > ,
5557}
5658
5759impl TestNode {
@@ -72,6 +74,7 @@ impl TestNode {
7274 . launch ( )
7375 . await
7476 . expect ( "failed to launch node" ) ,
77+ _db_temp_dir : None ,
7578 }
7679 }
7780
@@ -88,10 +91,7 @@ impl TestNode {
8891 /// Copies the database to a temp directory so each test gets its own mutable copy.
8992 /// The database is opened with [`SyncMode::UtterlyNoSync`] for test performance.
9093 pub async fn new_from_db_with_config ( db_path : & Path , config : Config ) -> Self {
91- let temp_dir = tempfile:: Builder :: new ( )
92- . disable_cleanup ( true )
93- . tempdir ( )
94- . expect ( "failed to create temp dir" ) ;
94+ let temp_dir = tempfile:: tempdir ( ) . expect ( "failed to create temp dir" ) ;
9595
9696 copy_db_dir ( db_path, temp_dir. path ( ) ) . expect ( "failed to copy database" ) ;
9797
@@ -104,6 +104,7 @@ impl TestNode {
104104 . launch ( )
105105 . await
106106 . expect ( "failed to launch node" ) ,
107+ _db_temp_dir : Some ( temp_dir) ,
107108 }
108109 }
109110
@@ -131,6 +132,7 @@ impl ForkTestNode {
131132 . launch ( )
132133 . await
133134 . expect ( "failed to launch node" ) ,
135+ _db_temp_dir : None ,
134136 }
135137 }
136138}
0 commit comments