File tree Expand file tree Collapse file tree 1 file changed +27
-0
lines changed
internal/cardano-node/mithril-cardano-node-internal-database/src/entities Expand file tree Collapse file tree 1 file changed +27
-0
lines changed Original file line number Diff line number Diff line change @@ -426,6 +426,33 @@ mod tests {
426
426
) ;
427
427
}
428
428
429
+ #[ test]
430
+ fn find_immutables_dir_returns_none_if_no_immutable_dir_found ( ) {
431
+ let database_path = temp_dir_create ! ( ) ;
432
+ assert ! ( find_immutables_dir( & database_path) . is_none( ) ) ;
433
+ }
434
+
435
+ #[ test]
436
+ fn find_immutables_dir_returns_immutable_dir_if_found_at_root ( ) {
437
+ let database_path = temp_dir_create ! ( ) ;
438
+ fs:: create_dir ( database_path. join ( IMMUTABLE_DIR ) ) . unwrap ( ) ;
439
+
440
+ let immutable_dir =
441
+ find_immutables_dir ( & database_path) . expect ( "Immutable directory should be found" ) ;
442
+ assert_eq ! ( immutable_dir, database_path. join( IMMUTABLE_DIR ) ) ;
443
+ }
444
+
445
+ #[ test]
446
+ fn find_immutables_dir_returns_immutable_dir_if_found_at_any_depth ( ) {
447
+ let database_path = temp_dir_create ! ( ) ;
448
+ let subdir = database_path. join ( "one/two/three" ) ;
449
+ fs:: create_dir_all ( subdir. join ( IMMUTABLE_DIR ) ) . unwrap ( ) ;
450
+
451
+ let immutable_dir =
452
+ find_immutables_dir ( & database_path) . expect ( "Immutable directory should be found" ) ;
453
+ assert_eq ! ( immutable_dir, subdir. join( IMMUTABLE_DIR ) ) ;
454
+ }
455
+
429
456
#[ test]
430
457
fn at_least_one_immutable_files_exist_in_dir_throw_error_if_immutable_dir_is_empty ( ) {
431
458
let database_path = temp_dir_create ! ( ) ;
You can’t perform that action at this time.
0 commit comments