test_minimize_accounts_db uses write cache correctly (#29333)

This commit is contained in:
Jeff Washington (jwash) 2022-12-20 11:50:56 -06:00 committed by GitHub
parent 053775ad77
commit 098b86b883
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 4 deletions

View File

@ -16191,7 +16191,7 @@ pub mod tests {
impl AccountsDb {
/// useful to adapt tests written prior to introduction of the write cache
/// to use the write cache
fn add_root_and_flush_write_cache(&self, slot: Slot) {
pub fn add_root_and_flush_write_cache(&self, slot: Slot) {
self.add_root(slot);
self.flush_root_write_cache(slot);
}
@ -16212,7 +16212,7 @@ pub mod tests {
}
/// callers use to call store_uncached. But, this is not allowed anymore.
fn store_for_tests(&self, slot: Slot, accounts: &[(&Pubkey, &AccountSharedData)]) {
pub fn store_for_tests(&self, slot: Slot, accounts: &[(&Pubkey, &AccountSharedData)]) {
self.store(
(slot, accounts, INCLUDE_SLOT_IN_HASH_TESTS),
true,

View File

@ -657,14 +657,14 @@ mod tests {
current_slot += 1;
for (index, pubkey) in pubkeys.iter().enumerate() {
accounts.store_uncached(current_slot, &[(pubkey, &account)]);
accounts.store_for_tests(current_slot, &[(pubkey, &account)]);
if current_slot % 2 == 0 && index % 100 == 0 {
minimized_account_set.insert(*pubkey);
}
}
accounts.get_accounts_delta_hash(current_slot);
accounts.add_root(current_slot);
accounts.add_root_and_flush_write_cache(current_slot);
}
assert_eq!(minimized_account_set.len(), 6);