@@ -21,6 +21,7 @@ use uuid::Uuid;
21
21
/// * `Result<Uuid, Box<dyn ChromaError>>` - The UUID of the created sparse index file
22
22
pub async fn create_test_sparse_index (
23
23
storage : & Storage ,
24
+ root_id : Uuid ,
24
25
block_ids : Vec < Uuid > ,
25
26
prefix : Option < String > ,
26
27
) -> Result < Uuid , Box < dyn ChromaError > > {
@@ -43,7 +44,6 @@ pub async fn create_test_sparse_index(
43
44
sparse_index. set_count ( block_ids[ 0 ] , 1 ) ?;
44
45
45
46
// Create and save the sparse index file
46
- let root_id = Uuid :: new_v4 ( ) ;
47
47
let root_writer = RootWriter :: new ( Version :: V1_1 , root_id, sparse_index) ;
48
48
let root_manager = RootManager :: new ( storage. clone ( ) , Box :: new ( NopCache ) ) ;
49
49
root_manager. flush :: < & str > ( & root_writer) . await ?;
@@ -87,7 +87,8 @@ mod tests {
87
87
let storage = Storage :: Local ( LocalStorage :: new ( temp_dir. path ( ) . to_str ( ) . unwrap ( ) ) ) ;
88
88
89
89
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 ;
91
92
assert ! ( result. is_ok( ) ) ;
92
93
93
94
// Verify the sparse index was created by trying to read it
@@ -107,7 +108,7 @@ mod tests {
107
108
let temp_dir = TempDir :: new ( ) . unwrap ( ) ;
108
109
let storage = Storage :: Local ( LocalStorage :: new ( temp_dir. path ( ) . to_str ( ) . unwrap ( ) ) ) ;
109
110
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 ;
111
112
assert ! ( matches!(
112
113
result,
113
114
Err ( e) if e. to_string( ) . contains( "Cannot create sparse index with empty block IDs" )
@@ -121,7 +122,7 @@ mod tests {
121
122
122
123
let block_ids = vec ! [ Uuid :: new_v4( ) , Uuid :: new_v4( ) ] ;
123
124
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 ;
125
126
assert ! ( result. is_ok( ) ) ;
126
127
}
127
128
}
0 commit comments