test_get_snapshot_storages_only_non_empty uses write cache (#29111)

This commit is contained in:
Jeff Washington (jwash) 2022-12-07 11:19:17 -06:00 committed by GitHub
parent 59359c3ab4
commit 284c41a6db
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 8 deletions

View File

@ -13144,7 +13144,8 @@ pub mod tests {
#[test]
fn test_get_snapshot_storages_only_non_empty() {
let db = AccountsDb::new(Vec::new(), &ClusterType::Development);
let mut db = AccountsDb::new(Vec::new(), &ClusterType::Development);
db.caching_enabled = true;
let key = Pubkey::default();
let account = AccountSharedData::new(1, 0, &key);
@ -13152,16 +13153,11 @@ pub mod tests {
let after_slot = base_slot + 1;
db.store_for_tests(base_slot, &[(&key, &account)]);
db.storage
.get_slot_stores(base_slot)
.unwrap()
.write()
.unwrap()
.clear();
db.add_root(base_slot);
// stored account is in write cache, so no storages yet
assert!(db.get_snapshot_storages(..=after_slot, None).0.is_empty());
db.store_for_tests(base_slot, &[(&key, &account)]);
db.add_root_and_flush_write_cache(base_slot);
assert_eq!(1, db.get_snapshot_storages(..=after_slot, None).0.len());
}