@@ -309,7 +309,7 @@ mod tests {
309
309
310
310
use mithril_common:: digesters:: DummyCardanoDbBuilder ;
311
311
use mithril_common:: test_utils:: assert_equivalent;
312
- use mithril_common:: { current_function, temp_dir_create} ;
312
+ use mithril_common:: { assert_dir_eq , current_function, temp_dir_create} ;
313
313
314
314
use crate :: services:: ancillary_signer:: MockAncillarySigner ;
315
315
use crate :: test_tools:: TestLogger ;
@@ -509,7 +509,6 @@ mod tests {
509
509
}
510
510
511
511
mod snapshot_ancillary {
512
- use mithril_common:: digesters:: VOLATILE_DIR ;
513
512
use mithril_common:: test_utils:: fake_keys;
514
513
515
514
use super :: * ;
@@ -524,19 +523,24 @@ mod tests {
524
523
. build ( ) ;
525
524
let snapshotter =
526
525
snapshotter_for_test ( & test_dir, cardano_db. get_dir ( ) , CompressionAlgorithm :: Gzip ) ;
526
+ let ancillary_snapshot_dir = test_dir. join ( "ancillary_snapshot" ) ;
527
+ fs:: create_dir ( & ancillary_snapshot_dir) . unwrap ( ) ;
527
528
528
529
snapshotter
529
- . get_files_and_directories_for_ancillary_snapshot ( 1 , & test_dir )
530
+ . get_files_and_directories_for_ancillary_snapshot ( 1 , & ancillary_snapshot_dir )
530
531
. unwrap ( ) ;
531
- assert ! ( test_dir. join( IMMUTABLE_DIR ) . exists( ) ) ;
532
- assert ! ( test_dir. join( IMMUTABLE_DIR ) . join( "00002.chunk" ) . exists( ) ) ;
533
- assert ! ( test_dir. join( IMMUTABLE_DIR ) . join( "00002.primary" ) . exists( ) ) ;
534
- assert ! ( test_dir
535
- . join( IMMUTABLE_DIR )
536
- . join( "00002.secondary" )
537
- . exists( ) ) ;
538
- assert ! ( test_dir. join( LEDGER_DIR ) . exists( ) ) ;
539
- assert ! ( test_dir. join( LEDGER_DIR ) . join( "737" ) . exists( ) ) ;
532
+
533
+ assert_dir_eq ! (
534
+ & ancillary_snapshot_dir,
535
+ format!(
536
+ "* {IMMUTABLE_DIR}/
537
+ ** 00002.chunk
538
+ ** 00002.primary
539
+ ** 00002.secondary
540
+ * {LEDGER_DIR}/
541
+ ** 737"
542
+ )
543
+ ) ;
540
544
}
541
545
542
546
#[ tokio:: test]
@@ -616,22 +620,20 @@ mod tests {
616
620
. unwrap ( ) ;
617
621
618
622
let unpack_dir = snapshot. unpack_gzip ( & test_dir) ;
619
-
620
- let expected_immutable_path = unpack_dir. join ( IMMUTABLE_DIR ) ;
621
- assert ! ( expected_immutable_path. join( "00003.chunk" ) . exists( ) ) ;
622
- assert ! ( expected_immutable_path. join( "00003.primary" ) . exists( ) ) ;
623
- assert ! ( expected_immutable_path. join( "00003.secondary" ) . exists( ) ) ;
624
- assert_eq ! ( 3 , list_files( & expected_immutable_path) . len( ) ) ;
625
-
626
- // Only the last ledger file should be included
627
- let expected_ledger_path = unpack_dir. join ( LEDGER_DIR ) ;
628
- assert ! ( expected_ledger_path. join( "737" ) . exists( ) ) ;
629
- assert_eq ! ( 1 , list_files( & expected_ledger_path) . len( ) ) ;
630
-
631
- let expected_volatile_path = unpack_dir. join ( VOLATILE_DIR ) ;
632
- assert ! ( !expected_volatile_path. exists( ) ) ;
633
-
634
- assert ! ( !unpack_dir. join( "whatever" ) . exists( ) ) ;
623
+ assert_dir_eq ! (
624
+ & unpack_dir,
625
+ // Only the last ledger file should be included
626
+ format!(
627
+ "* {IMMUTABLE_DIR}/
628
+ ** 00003.chunk
629
+ ** 00003.primary
630
+ ** 00003.secondary
631
+ * {LEDGER_DIR}/
632
+ ** 737
633
+ * {}" ,
634
+ AncillaryFilesManifest :: ANCILLARY_MANIFEST_FILE_NAME
635
+ )
636
+ ) ;
635
637
}
636
638
637
639
#[ tokio:: test]
0 commit comments