Fix test_concurrent_snapshot_packaging
This commit is contained in:
parent
87b13bef8e
commit
3acf956f6f
|
@ -232,9 +232,8 @@ mod tests {
|
|||
let saved_snapshots_dir = TempDir::new().unwrap();
|
||||
let saved_accounts_dir = TempDir::new().unwrap();
|
||||
let saved_slot = 4;
|
||||
let saved_tar = snapshot_config
|
||||
.snapshot_package_output_path
|
||||
.join(saved_slot.to_string());
|
||||
let mut saved_archive_path = None;
|
||||
|
||||
for forks in 0..MAX_CACHE_ENTRIES + 2 {
|
||||
let bank = Bank::new_from_parent(
|
||||
&bank_forks[forks as u64],
|
||||
|
@ -246,6 +245,7 @@ mod tests {
|
|||
let tx = system_transaction::transfer(&mint_keypair, &key1, 1, genesis_config.hash());
|
||||
assert_eq!(bank.process_transaction(&tx), Ok(()));
|
||||
bank.squash();
|
||||
let accounts_hash = bank.update_accounts_hash();
|
||||
bank_forks.insert(bank);
|
||||
|
||||
let package_sender = {
|
||||
|
@ -286,6 +286,11 @@ mod tests {
|
|||
&options,
|
||||
)
|
||||
.unwrap();
|
||||
|
||||
saved_archive_path = Some(snapshot_utils::get_snapshot_archive_path(
|
||||
&snapshot_config.snapshot_package_output_path,
|
||||
&(slot, accounts_hash),
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -323,7 +328,7 @@ mod tests {
|
|||
.join()
|
||||
.expect("SnapshotPackagerService exited with error");
|
||||
|
||||
// Check the tar we cached the state for earlier was generated correctly
|
||||
// Check the archive we cached the state for earlier was generated correctly
|
||||
|
||||
// before we compare, stick an empty status_cache in this dir so that the package comparision works
|
||||
// This is needed since the status_cache is added by the packager and is not collected from
|
||||
|
@ -342,7 +347,7 @@ mod tests {
|
|||
.unwrap();
|
||||
|
||||
snapshot_utils::verify_snapshot_archive(
|
||||
saved_tar,
|
||||
saved_archive_path.unwrap(),
|
||||
saved_snapshots_dir.path(),
|
||||
saved_accounts_dir
|
||||
.path()
|
||||
|
|
|
@ -220,7 +220,8 @@ pub fn archive_snapshot_package(snapshot_package: &SnapshotPackage) -> Result<()
|
|||
|
||||
timer.stop();
|
||||
info!(
|
||||
"Successfully created tarball. slot: {}, elapsed ms: {}, size={}",
|
||||
"Successfully created {:?}. slot: {}, elapsed ms: {}, size={}",
|
||||
snapshot_package.tar_output_file,
|
||||
snapshot_package.root,
|
||||
timer.as_ms(),
|
||||
metadata.len()
|
||||
|
@ -639,7 +640,7 @@ fn get_io_error(error: &str) -> SnapshotError {
|
|||
}
|
||||
|
||||
pub fn verify_snapshot_archive<P, Q, R>(
|
||||
snapshot_tar: P,
|
||||
snapshot_archive: P,
|
||||
snapshots_to_verify: Q,
|
||||
storages_to_verify: R,
|
||||
) where
|
||||
|
@ -649,7 +650,7 @@ pub fn verify_snapshot_archive<P, Q, R>(
|
|||
{
|
||||
let temp_dir = tempfile::TempDir::new().unwrap();
|
||||
let unpack_dir = temp_dir.path();
|
||||
untar_snapshot_in(snapshot_tar, &unpack_dir).unwrap();
|
||||
untar_snapshot_in(snapshot_archive, &unpack_dir).unwrap();
|
||||
|
||||
// Check snapshots are the same
|
||||
let unpacked_snapshots = unpack_dir.join(&TAR_SNAPSHOTS_DIR);
|
||||
|
|
Loading…
Reference in New Issue