From bd94a92e7da5dabf418953849c37c5ba76c56ce0 Mon Sep 17 00:00:00 2001 From: Xiang Zhu Date: Thu, 19 Jan 2023 18:05:46 -0800 Subject: [PATCH] fix test test_concurrent_snapshot_packaging --- runtime/src/snapshot_utils.rs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/runtime/src/snapshot_utils.rs b/runtime/src/snapshot_utils.rs index 5b4dd871c59cce..6c134af6cfc621 100644 --- a/runtime/src/snapshot_utils.rs +++ b/runtime/src/snapshot_utils.rs @@ -2286,9 +2286,12 @@ pub fn verify_snapshot_archive( } assert!(!dir_diff::is_different(&snapshots_to_verify, unpacked_snapshots).unwrap()); - // The account files in the archive accounts/ have been expanded to [account_paths]. + // In the unarchiving case, there is an extra empty "accounts" directory. The account + // files in the archive accounts/ have been expanded to [account_paths]. // Remove the empty "accounts" directory for the directory comparison below. - std::fs::remove_dir(account_dir.join("accounts")).unwrap(); + // In some test cases the directory to compare do not come from unchiving. Use + // unwarp_or_default to ignore the error if this directory does not exist. + std::fs::remove_dir(account_dir.join("accounts")).unwrap_or_default(); // Check the account entries are the same assert!(!dir_diff::is_different(&storages_to_verify, account_dir).unwrap()); }