test_get_snapshot_storages_only_non_empty uses write cache (#29111)
This commit is contained in:
parent
59359c3ab4
commit
284c41a6db
|
@ -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());
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue