@@ -21,6 +21,7 @@ use uuid::Uuid;
2121/// * `Result<Uuid, Box<dyn ChromaError>>` - The UUID of the created sparse index file
2222pub async fn create_test_sparse_index (
2323 storage : & Storage ,
24+ root_id : Uuid ,
2425 block_ids : Vec < Uuid > ,
2526 prefix : Option < String > ,
2627) -> Result < Uuid , Box < dyn ChromaError > > {
@@ -43,7 +44,6 @@ pub async fn create_test_sparse_index(
4344 sparse_index. set_count ( block_ids[ 0 ] , 1 ) ?;
4445
4546 // Create and save the sparse index file
46- let root_id = Uuid :: new_v4 ( ) ;
4747 let root_writer = RootWriter :: new ( Version :: V1_1 , root_id, sparse_index) ;
4848 let root_manager = RootManager :: new ( storage. clone ( ) , Box :: new ( NopCache ) ) ;
4949 root_manager. flush :: < & str > ( & root_writer) . await ?;
@@ -87,7 +87,8 @@ mod tests {
8787 let storage = Storage :: Local ( LocalStorage :: new ( temp_dir. path ( ) . to_str ( ) . unwrap ( ) ) ) ;
8888
8989 let block_ids = vec ! [ Uuid :: new_v4( ) , Uuid :: new_v4( ) , Uuid :: new_v4( ) ] ;
90- let result = create_test_sparse_index ( & storage, block_ids. clone ( ) , None ) . await ;
90+ let result =
91+ create_test_sparse_index ( & storage, Uuid :: new_v4 ( ) , block_ids. clone ( ) , None ) . await ;
9192 assert ! ( result. is_ok( ) ) ;
9293
9394 // Verify the sparse index was created by trying to read it
@@ -107,7 +108,7 @@ mod tests {
107108 let temp_dir = TempDir :: new ( ) . unwrap ( ) ;
108109 let storage = Storage :: Local ( LocalStorage :: new ( temp_dir. path ( ) . to_str ( ) . unwrap ( ) ) ) ;
109110
110- let result = create_test_sparse_index ( & storage, vec ! [ ] , None ) . await ;
111+ let result = create_test_sparse_index ( & storage, Uuid :: new_v4 ( ) , vec ! [ ] , None ) . await ;
111112 assert ! ( matches!(
112113 result,
113114 Err ( e) if e. to_string( ) . contains( "Cannot create sparse index with empty block IDs" )
@@ -121,7 +122,7 @@ mod tests {
121122
122123 let block_ids = vec ! [ Uuid :: new_v4( ) , Uuid :: new_v4( ) ] ;
123124 let prefix = Some ( "custom" . to_string ( ) ) ;
124- let result = create_test_sparse_index ( & storage, block_ids, prefix) . await ;
125+ let result = create_test_sparse_index ( & storage, Uuid :: new_v4 ( ) , block_ids, prefix) . await ;
125126 assert ! ( result. is_ok( ) ) ;
126127 }
127128}
0 commit comments