Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

make test code more clear #27260

Merged
merged 1 commit into from
Aug 19, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion runtime/src/accounts_db.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5541,7 +5541,8 @@ impl AccountsDb {
.fetch_add(recycle_stores_write_elapsed.as_us(), Ordering::Relaxed);
}

pub fn flush_accounts_cache_slot(&self, slot: Slot) {
#[cfg(test)]
pub(crate) fn flush_accounts_cache_slot_for_tests(&self, slot: Slot) {
self.flush_slot_cache(slot);
}

Expand Down
6 changes: 3 additions & 3 deletions runtime/src/bank.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6421,11 +6421,11 @@ impl Bank {
}

#[cfg(test)]
pub fn flush_accounts_cache_slot(&self) {
pub fn flush_accounts_cache_slot_for_tests(&self) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: only use of this is in bank tests, we can remove the pub

self.rc
.accounts
.accounts_db
.flush_accounts_cache_slot(self.slot())
.flush_accounts_cache_slot_for_tests(self.slot())
}

pub fn expire_old_recycle_stores(&self) {
Expand Down Expand Up @@ -14670,7 +14670,7 @@ pub(crate) mod tests {
bank1.deposit(&pubkey0, some_lamports).unwrap();
goto_end_of_slot(Arc::<Bank>::get_mut(&mut bank1).unwrap());
bank1.freeze();
bank1.flush_accounts_cache_slot();
bank1.flush_accounts_cache_slot_for_tests();

bank1.print_accounts_stats();

Expand Down