From a6a1355b8035697d83ec836a33c7c828f6e86552 Mon Sep 17 00:00:00 2001 From: "Jeff Washington (jwash)" <75863576+jeffwashington@users.noreply.github.com> Date: Mon, 10 May 2021 08:54:30 -0500 Subject: [PATCH] fix secondary index test (#17111) --- runtime/src/accounts_index.rs | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/runtime/src/accounts_index.rs b/runtime/src/accounts_index.rs index f761af39c9..223b308021 100644 --- a/runtime/src/accounts_index.rs +++ b/runtime/src/accounts_index.rs @@ -2912,8 +2912,8 @@ pub mod tests { true, &mut vec![], ); - assert!(index.spl_token_mint_index.index.is_empty()); - assert!(index.spl_token_mint_index.reverse_index.is_empty()); + assert!(secondary_index.index.is_empty()); + assert!(secondary_index.reverse_index.is_empty()); // Wrong account data size index.upsert( @@ -2925,8 +2925,8 @@ pub mod tests { true, &mut vec![], ); - assert!(index.spl_token_mint_index.index.is_empty()); - assert!(index.spl_token_mint_index.reverse_index.is_empty()); + assert!(secondary_index.index.is_empty()); + assert!(secondary_index.reverse_index.is_empty()); // Just right. Inserting the same index multiple times should be ok for _ in 0..2 { @@ -2940,15 +2940,19 @@ pub mod tests { check_secondary_index_unique(secondary_index, slot, &index_key, &account_key); } + // included + assert!(!secondary_index.index.is_empty()); + assert!(!secondary_index.reverse_index.is_empty()); + index .get_account_write_entry(&account_key) .unwrap() .slot_list_mut(|slot_list| slot_list.clear()); // Everything should be deleted - index.handle_dead_keys(&[&account_key], account_index); - assert!(index.spl_token_mint_index.index.is_empty()); - assert!(index.spl_token_mint_index.reverse_index.is_empty()); + index.handle_dead_keys(&[&account_key], &account_index); + assert!(secondary_index.index.is_empty()); + assert!(secondary_index.reverse_index.is_empty()); } #[test]