@@ -92,10 +92,12 @@ impl InternalArtifactProver {
92
92
locations_sorted. sort ( ) ;
93
93
for location in locations_sorted {
94
94
let download_id = MithrilEvent :: new_cardano_database_download_id ( ) ;
95
- let file_downloader = match & location {
96
- DigestLocation :: CloudStorage { .. } | DigestLocation :: Aggregator { .. } => {
97
- self . http_file_downloader . clone ( )
98
- }
95
+ let ( file_downloader, compression_algorithm) = match & location {
96
+ DigestLocation :: CloudStorage {
97
+ uri : _,
98
+ compression_algorithm,
99
+ } => ( self . http_file_downloader . clone ( ) , * compression_algorithm) ,
100
+ DigestLocation :: Aggregator { .. } => ( self . http_file_downloader . clone ( ) , None ) ,
99
101
// Note: unknown locations should have been filtered out by `sanitized_locations`
100
102
DigestLocation :: Unknown => unreachable ! ( ) ,
101
103
} ;
@@ -105,7 +107,7 @@ impl InternalArtifactProver {
105
107
& file_downloader_uri,
106
108
digests_locations. size_uncompressed ,
107
109
digests_file_target_dir,
108
- None ,
110
+ compression_algorithm ,
109
111
DownloadEvent :: Digest {
110
112
download_id : download_id. clone ( ) ,
111
113
} ,
@@ -339,6 +341,8 @@ mod tests {
339
341
340
342
mod download_unpack_digest_file {
341
343
344
+ use mithril_common:: entities:: CompressionAlgorithm ;
345
+
342
346
use crate :: file_downloader:: MockFileDownloader ;
343
347
344
348
use super :: * ;
@@ -466,6 +470,40 @@ mod tests {
466
470
. await
467
471
. unwrap ( ) ;
468
472
}
473
+
474
+ #[ tokio:: test]
475
+ async fn should_call_download_with_compression_algorithm ( ) {
476
+ let target_dir = Path :: new ( "." ) ;
477
+ let artifact_prover = InternalArtifactProver :: new (
478
+ Arc :: new (
479
+ MockFileDownloaderBuilder :: default ( )
480
+ . with_compression ( Some ( CompressionAlgorithm :: Gzip ) )
481
+ . with_times ( 1 )
482
+ . with_success ( )
483
+ . build ( ) ,
484
+ ) ,
485
+ test_utils:: test_logger ( ) ,
486
+ ) ;
487
+
488
+ artifact_prover
489
+ . download_unpack_digest_file (
490
+ & DigestsMessagePart {
491
+ locations : vec ! [
492
+ DigestLocation :: CloudStorage {
493
+ uri: "http://whatever-1/digests.tar.gz" . to_string( ) ,
494
+ compression_algorithm: Some ( CompressionAlgorithm :: Gzip ) ,
495
+ } ,
496
+ DigestLocation :: Aggregator {
497
+ uri: "http://whatever-2/digest" . to_string( ) ,
498
+ } ,
499
+ ] ,
500
+ size_uncompressed : 0 ,
501
+ } ,
502
+ target_dir,
503
+ )
504
+ . await
505
+ . unwrap ( ) ;
506
+ }
469
507
}
470
508
471
509
mod read_digest_file {
0 commit comments