From 109f7ac6cd7ea6a618aeda0919687ca5c9dd581e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9goire=20HUBERT=20/=20PALO-IT?= Date: Tue, 11 Jul 2023 14:34:34 +0200 Subject: [PATCH] add extension to downloaded snapshots --- .../src/aggregator_client/snapshot_client.rs | 2 +- mithril-client/src/services/snapshot.rs | 14 +++++++++++--- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/mithril-client/src/aggregator_client/snapshot_client.rs b/mithril-client/src/aggregator_client/snapshot_client.rs index 8b2a5764b29..b620d77150d 100644 --- a/mithril-client/src/aggregator_client/snapshot_client.rs +++ b/mithril-client/src/aggregator_client/snapshot_client.rs @@ -67,7 +67,7 @@ impl SnapshotClient { ) -> StdResult { let filepath = PathBuf::new() .join(download_dir) - .join(format!("snapshot-{}", snapshot.digest)); + .join(format!("snapshot-{}.tar.gz", snapshot.digest)); for url in snapshot.locations.as_slice() { if self.http_client.probe(url).await.is_ok() { diff --git a/mithril-client/src/services/snapshot.rs b/mithril-client/src/services/snapshot.rs index 1015ad6254d..e9d26e04e7b 100644 --- a/mithril-client/src/services/snapshot.rs +++ b/mithril-client/src/services/snapshot.rs @@ -500,7 +500,11 @@ mod tests { let (_, verifier) = setup_genesis(); let genesis_verification_key = verifier.to_verification_key(); - build_dummy_snapshot("digest-10", "1234567890".repeat(124).as_str(), &test_path); + build_dummy_snapshot( + "digest-10.tar.gz", + "1234567890".repeat(124).as_str(), + &test_path, + ); let filepath = snapshot_service .download( &snapshot, @@ -551,7 +555,11 @@ mod tests { let (_, verifier) = setup_genesis(); let genesis_verification_key = verifier.to_verification_key(); - build_dummy_snapshot("digest-10", "1234567890".repeat(124).as_str(), &test_path); + build_dummy_snapshot( + "digest-10.tar.gz", + "1234567890".repeat(124).as_str(), + &test_path, + ); let err = snapshot_service .download( &signed_entity, @@ -577,7 +585,7 @@ mod tests { "Expected a SnapshotServiceError when snapshot can not be verified. Got {err:?}: '{err}'" ); } - let filepath = test_path.join("snapshot-digest-10"); + let filepath = test_path.join("snapshot-digest-10.tar.gz"); assert!(filepath.exists()); let unpack_dir = filepath .parent()