From 10eadb6dd9d4174390879c14f301148899fb958f Mon Sep 17 00:00:00 2001 From: "Jeff Washington (jwash)" Date: Tue, 3 Jan 2023 10:59:21 -0600 Subject: [PATCH] add test method assert_no_storages_at_slot() (#29483) --- runtime/src/accounts_db.rs | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/runtime/src/accounts_db.rs b/runtime/src/accounts_db.rs index 7eae0dcc6f..a84773a0ea 100644 --- a/runtime/src/accounts_db.rs +++ b/runtime/src/accounts_db.rs @@ -15129,7 +15129,7 @@ pub mod tests { db.clean_accounts(Some(2), false, None); // No stores should exist for slot 0 after clean - assert!(db.storage.get_slot_storage_entries(0).is_none()); + assert_no_storages_at_slot(&db, 0); // Ref count for `account_key1` (account removed earlier by shrink) // should be 1, since it was only stored in slot 0 and 1, and slot 0 @@ -15651,7 +15651,7 @@ pub mod tests { // cache, storage, and index for (slot, _) in slots_to_dump { - assert!(db.storage.get_slot_storage_entries(*slot).is_none()); + assert_no_storages_at_slot(&db, *slot); assert!(db.accounts_cache.slot_cache(*slot).is_none()); let account_in_slot = slot_to_pubkey_map[slot]; let item = db.accounts_index.get_account_read_entry(&account_in_slot); @@ -16033,7 +16033,12 @@ pub mod tests { .accounts_index .get_account_read_entry(&shared_key) .is_none()); - assert!(accounts.storage.get_slot_storage_entries(slot0).is_none()); + assert_no_storages_at_slot(&accounts, slot0); + } + + /// asserts that not only are there 0 append vecs, but there is not even an entry in the storage map for 'slot' + fn assert_no_storages_at_slot(db: &AccountsDb, slot: Slot) { + assert!(db.storage.get_slot_storage_entries(slot).is_none()); } /// Test to make sure `clean_accounts()` works properly with the `last_full_snapshot_slot`