Skip to content
This repository was archived by the owner on Jan 22, 2025. It is now read-only.

Commit 3acf956

Browse files
committed
Fix test_concurrent_snapshot_packaging
1 parent 87b13be commit 3acf956

File tree

2 files changed

+14
-8
lines changed

2 files changed

+14
-8
lines changed

core/tests/bank_forks.rs

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -232,9 +232,8 @@ mod tests {
232232
let saved_snapshots_dir = TempDir::new().unwrap();
233233
let saved_accounts_dir = TempDir::new().unwrap();
234234
let saved_slot = 4;
235-
let saved_tar = snapshot_config
236-
.snapshot_package_output_path
237-
.join(saved_slot.to_string());
235+
let mut saved_archive_path = None;
236+
238237
for forks in 0..MAX_CACHE_ENTRIES + 2 {
239238
let bank = Bank::new_from_parent(
240239
&bank_forks[forks as u64],
@@ -246,6 +245,7 @@ mod tests {
246245
let tx = system_transaction::transfer(&mint_keypair, &key1, 1, genesis_config.hash());
247246
assert_eq!(bank.process_transaction(&tx), Ok(()));
248247
bank.squash();
248+
let accounts_hash = bank.update_accounts_hash();
249249
bank_forks.insert(bank);
250250

251251
let package_sender = {
@@ -286,6 +286,11 @@ mod tests {
286286
&options,
287287
)
288288
.unwrap();
289+
290+
saved_archive_path = Some(snapshot_utils::get_snapshot_archive_path(
291+
&snapshot_config.snapshot_package_output_path,
292+
&(slot, accounts_hash),
293+
));
289294
}
290295
}
291296

@@ -323,7 +328,7 @@ mod tests {
323328
.join()
324329
.expect("SnapshotPackagerService exited with error");
325330

326-
// Check the tar we cached the state for earlier was generated correctly
331+
// Check the archive we cached the state for earlier was generated correctly
327332

328333
// before we compare, stick an empty status_cache in this dir so that the package comparision works
329334
// This is needed since the status_cache is added by the packager and is not collected from
@@ -342,7 +347,7 @@ mod tests {
342347
.unwrap();
343348

344349
snapshot_utils::verify_snapshot_archive(
345-
saved_tar,
350+
saved_archive_path.unwrap(),
346351
saved_snapshots_dir.path(),
347352
saved_accounts_dir
348353
.path()

ledger/src/snapshot_utils.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,8 @@ pub fn archive_snapshot_package(snapshot_package: &SnapshotPackage) -> Result<()
220220

221221
timer.stop();
222222
info!(
223-
"Successfully created tarball. slot: {}, elapsed ms: {}, size={}",
223+
"Successfully created {:?}. slot: {}, elapsed ms: {}, size={}",
224+
snapshot_package.tar_output_file,
224225
snapshot_package.root,
225226
timer.as_ms(),
226227
metadata.len()
@@ -639,7 +640,7 @@ fn get_io_error(error: &str) -> SnapshotError {
639640
}
640641

641642
pub fn verify_snapshot_archive<P, Q, R>(
642-
snapshot_tar: P,
643+
snapshot_archive: P,
643644
snapshots_to_verify: Q,
644645
storages_to_verify: R,
645646
) where
@@ -649,7 +650,7 @@ pub fn verify_snapshot_archive<P, Q, R>(
649650
{
650651
let temp_dir = tempfile::TempDir::new().unwrap();
651652
let unpack_dir = temp_dir.path();
652-
untar_snapshot_in(snapshot_tar, &unpack_dir).unwrap();
653+
untar_snapshot_in(snapshot_archive, &unpack_dir).unwrap();
653654

654655
// Check snapshots are the same
655656
let unpacked_snapshots = unpack_dir.join(&TAR_SNAPSHOTS_DIR);

0 commit comments

Comments
 (0)