cleanup test constants (#27704)
This commit is contained in:
parent
765c628546
commit
ac74fc16b6
|
@ -13235,8 +13235,7 @@ pub mod tests {
|
|||
);
|
||||
}
|
||||
|
||||
const UPSERT_PREVIOUS_SLOT_ENTRY_WAS_CACHED_FALSE: UpsertReclaim =
|
||||
UpsertReclaim::PopulateReclaims;
|
||||
const UPSERT_POPULATE_RECLAIMS: UpsertReclaim = UpsertReclaim::PopulateReclaims;
|
||||
|
||||
// returns the rooted entries and the storage ref count
|
||||
fn roots_and_ref_count<T: IndexValue>(
|
||||
|
@ -13270,7 +13269,7 @@ pub mod tests {
|
|||
&AccountSecondaryIndexes::default(),
|
||||
info0,
|
||||
&mut reclaims,
|
||||
UPSERT_PREVIOUS_SLOT_ENTRY_WAS_CACHED_FALSE,
|
||||
UPSERT_POPULATE_RECLAIMS,
|
||||
);
|
||||
accounts_index.upsert(
|
||||
1,
|
||||
|
@ -13280,7 +13279,7 @@ pub mod tests {
|
|||
&AccountSecondaryIndexes::default(),
|
||||
info1,
|
||||
&mut reclaims,
|
||||
UPSERT_PREVIOUS_SLOT_ENTRY_WAS_CACHED_FALSE,
|
||||
UPSERT_POPULATE_RECLAIMS,
|
||||
);
|
||||
accounts_index.upsert(
|
||||
1,
|
||||
|
@ -13290,7 +13289,7 @@ pub mod tests {
|
|||
&AccountSecondaryIndexes::default(),
|
||||
info1,
|
||||
&mut reclaims,
|
||||
UPSERT_PREVIOUS_SLOT_ENTRY_WAS_CACHED_FALSE,
|
||||
UPSERT_POPULATE_RECLAIMS,
|
||||
);
|
||||
accounts_index.upsert(
|
||||
2,
|
||||
|
@ -13300,7 +13299,7 @@ pub mod tests {
|
|||
&AccountSecondaryIndexes::default(),
|
||||
info2,
|
||||
&mut reclaims,
|
||||
UPSERT_PREVIOUS_SLOT_ENTRY_WAS_CACHED_FALSE,
|
||||
UPSERT_POPULATE_RECLAIMS,
|
||||
);
|
||||
accounts_index.upsert(
|
||||
2,
|
||||
|
@ -13310,7 +13309,7 @@ pub mod tests {
|
|||
&AccountSecondaryIndexes::default(),
|
||||
info2,
|
||||
&mut reclaims,
|
||||
UPSERT_PREVIOUS_SLOT_ENTRY_WAS_CACHED_FALSE,
|
||||
UPSERT_POPULATE_RECLAIMS,
|
||||
);
|
||||
accounts_index.upsert(
|
||||
3,
|
||||
|
@ -13320,7 +13319,7 @@ pub mod tests {
|
|||
&AccountSecondaryIndexes::default(),
|
||||
info3,
|
||||
&mut reclaims,
|
||||
UPSERT_PREVIOUS_SLOT_ENTRY_WAS_CACHED_FALSE,
|
||||
UPSERT_POPULATE_RECLAIMS,
|
||||
);
|
||||
accounts_index.add_root(0, false);
|
||||
accounts_index.add_root(1, false);
|
||||
|
|
|
@ -2338,8 +2338,7 @@ pub mod tests {
|
|||
assert!(index.include_key(&pk2));
|
||||
}
|
||||
|
||||
const UPSERT_PREVIOUS_SLOT_ENTRY_WAS_CACHED_FALSE: UpsertReclaim =
|
||||
UpsertReclaim::PopulateReclaims;
|
||||
const UPSERT_POPULATE_RECLAIMS: UpsertReclaim = UpsertReclaim::PopulateReclaims;
|
||||
|
||||
#[test]
|
||||
fn test_insert_no_ancestors() {
|
||||
|
@ -2354,7 +2353,7 @@ pub mod tests {
|
|||
&AccountSecondaryIndexes::default(),
|
||||
true,
|
||||
&mut gc,
|
||||
UPSERT_PREVIOUS_SLOT_ENTRY_WAS_CACHED_FALSE,
|
||||
UPSERT_POPULATE_RECLAIMS,
|
||||
);
|
||||
assert!(gc.is_empty());
|
||||
|
||||
|
@ -2584,7 +2583,7 @@ pub mod tests {
|
|||
&AccountSecondaryIndexes::default(),
|
||||
account_infos[0],
|
||||
&mut gc,
|
||||
UPSERT_PREVIOUS_SLOT_ENTRY_WAS_CACHED_FALSE,
|
||||
UPSERT_POPULATE_RECLAIMS,
|
||||
);
|
||||
} else {
|
||||
let items = vec![(key, account_infos[0])];
|
||||
|
@ -2623,7 +2622,7 @@ pub mod tests {
|
|||
&AccountSecondaryIndexes::default(),
|
||||
account_infos[1],
|
||||
&mut gc,
|
||||
UPSERT_PREVIOUS_SLOT_ENTRY_WAS_CACHED_FALSE,
|
||||
UPSERT_POPULATE_RECLAIMS,
|
||||
);
|
||||
} else {
|
||||
// this has the effect of aging out everything in the in-mem cache
|
||||
|
@ -2702,7 +2701,7 @@ pub mod tests {
|
|||
new_entry,
|
||||
None,
|
||||
&mut SlotList::default(),
|
||||
UPSERT_PREVIOUS_SLOT_ENTRY_WAS_CACHED_FALSE,
|
||||
UPSERT_POPULATE_RECLAIMS,
|
||||
);
|
||||
assert_eq!(1, account_maps_stats_len(&index));
|
||||
|
||||
|
@ -2742,7 +2741,7 @@ pub mod tests {
|
|||
&AccountSecondaryIndexes::default(),
|
||||
true,
|
||||
&mut gc,
|
||||
UPSERT_PREVIOUS_SLOT_ENTRY_WAS_CACHED_FALSE,
|
||||
UPSERT_POPULATE_RECLAIMS,
|
||||
);
|
||||
assert!(gc.is_empty());
|
||||
|
||||
|
@ -2867,7 +2866,7 @@ pub mod tests {
|
|||
&AccountSecondaryIndexes::default(),
|
||||
true,
|
||||
&mut gc,
|
||||
UPSERT_PREVIOUS_SLOT_ENTRY_WAS_CACHED_FALSE,
|
||||
UPSERT_POPULATE_RECLAIMS,
|
||||
);
|
||||
assert!(gc.is_empty());
|
||||
|
||||
|
@ -2906,7 +2905,7 @@ pub mod tests {
|
|||
&AccountSecondaryIndexes::default(),
|
||||
true,
|
||||
&mut vec![],
|
||||
UPSERT_PREVIOUS_SLOT_ENTRY_WAS_CACHED_FALSE,
|
||||
UPSERT_POPULATE_RECLAIMS,
|
||||
);
|
||||
new_pubkey
|
||||
})
|
||||
|
@ -2923,7 +2922,7 @@ pub mod tests {
|
|||
&AccountSecondaryIndexes::default(),
|
||||
true,
|
||||
&mut vec![],
|
||||
UPSERT_PREVIOUS_SLOT_ENTRY_WAS_CACHED_FALSE,
|
||||
UPSERT_POPULATE_RECLAIMS,
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -3066,7 +3065,7 @@ pub mod tests {
|
|||
&AccountSecondaryIndexes::default(),
|
||||
true,
|
||||
&mut gc,
|
||||
UPSERT_PREVIOUS_SLOT_ENTRY_WAS_CACHED_FALSE,
|
||||
UPSERT_POPULATE_RECLAIMS,
|
||||
);
|
||||
assert!(iter.next().is_none());
|
||||
}
|
||||
|
@ -3092,7 +3091,7 @@ pub mod tests {
|
|||
&AccountSecondaryIndexes::default(),
|
||||
true,
|
||||
&mut gc,
|
||||
UPSERT_PREVIOUS_SLOT_ENTRY_WAS_CACHED_FALSE,
|
||||
UPSERT_POPULATE_RECLAIMS,
|
||||
);
|
||||
assert!(gc.is_empty());
|
||||
|
||||
|
@ -3207,7 +3206,7 @@ pub mod tests {
|
|||
&AccountSecondaryIndexes::default(),
|
||||
true,
|
||||
&mut gc,
|
||||
UPSERT_PREVIOUS_SLOT_ENTRY_WAS_CACHED_FALSE,
|
||||
UPSERT_POPULATE_RECLAIMS,
|
||||
);
|
||||
assert!(gc.is_empty());
|
||||
let (list, idx) = index.get_for_tests(&key, Some(&ancestors), None).unwrap();
|
||||
|
@ -3223,7 +3222,7 @@ pub mod tests {
|
|||
&AccountSecondaryIndexes::default(),
|
||||
false,
|
||||
&mut gc,
|
||||
UPSERT_PREVIOUS_SLOT_ENTRY_WAS_CACHED_FALSE,
|
||||
UPSERT_POPULATE_RECLAIMS,
|
||||
);
|
||||
assert_eq!(gc, vec![(0, true)]);
|
||||
let (list, idx) = index.get_for_tests(&key, Some(&ancestors), None).unwrap();
|
||||
|
@ -3245,7 +3244,7 @@ pub mod tests {
|
|||
&AccountSecondaryIndexes::default(),
|
||||
true,
|
||||
&mut gc,
|
||||
UPSERT_PREVIOUS_SLOT_ENTRY_WAS_CACHED_FALSE,
|
||||
UPSERT_POPULATE_RECLAIMS,
|
||||
);
|
||||
assert!(gc.is_empty());
|
||||
index.upsert(
|
||||
|
@ -3256,7 +3255,7 @@ pub mod tests {
|
|||
&AccountSecondaryIndexes::default(),
|
||||
false,
|
||||
&mut gc,
|
||||
UPSERT_PREVIOUS_SLOT_ENTRY_WAS_CACHED_FALSE,
|
||||
UPSERT_POPULATE_RECLAIMS,
|
||||
);
|
||||
assert!(gc.is_empty());
|
||||
let (list, idx) = index.get_for_tests(&key, Some(&ancestors), None).unwrap();
|
||||
|
@ -3279,7 +3278,7 @@ pub mod tests {
|
|||
&AccountSecondaryIndexes::default(),
|
||||
true,
|
||||
&mut gc,
|
||||
UPSERT_PREVIOUS_SLOT_ENTRY_WAS_CACHED_FALSE,
|
||||
UPSERT_POPULATE_RECLAIMS,
|
||||
);
|
||||
assert!(gc.is_empty());
|
||||
index.upsert(
|
||||
|
@ -3290,7 +3289,7 @@ pub mod tests {
|
|||
&AccountSecondaryIndexes::default(),
|
||||
false,
|
||||
&mut gc,
|
||||
UPSERT_PREVIOUS_SLOT_ENTRY_WAS_CACHED_FALSE,
|
||||
UPSERT_POPULATE_RECLAIMS,
|
||||
);
|
||||
index.upsert(
|
||||
2,
|
||||
|
@ -3300,7 +3299,7 @@ pub mod tests {
|
|||
&AccountSecondaryIndexes::default(),
|
||||
true,
|
||||
&mut gc,
|
||||
UPSERT_PREVIOUS_SLOT_ENTRY_WAS_CACHED_FALSE,
|
||||
UPSERT_POPULATE_RECLAIMS,
|
||||
);
|
||||
index.upsert(
|
||||
3,
|
||||
|
@ -3310,7 +3309,7 @@ pub mod tests {
|
|||
&AccountSecondaryIndexes::default(),
|
||||
true,
|
||||
&mut gc,
|
||||
UPSERT_PREVIOUS_SLOT_ENTRY_WAS_CACHED_FALSE,
|
||||
UPSERT_POPULATE_RECLAIMS,
|
||||
);
|
||||
index.add_root(0, false);
|
||||
index.add_root(1, false);
|
||||
|
@ -3323,7 +3322,7 @@ pub mod tests {
|
|||
&AccountSecondaryIndexes::default(),
|
||||
true,
|
||||
&mut gc,
|
||||
UPSERT_PREVIOUS_SLOT_ENTRY_WAS_CACHED_FALSE,
|
||||
UPSERT_POPULATE_RECLAIMS,
|
||||
);
|
||||
|
||||
// Updating index should not purge older roots, only purges
|
||||
|
@ -3368,7 +3367,7 @@ pub mod tests {
|
|||
&AccountSecondaryIndexes::default(),
|
||||
12,
|
||||
&mut gc,
|
||||
UPSERT_PREVIOUS_SLOT_ENTRY_WAS_CACHED_FALSE,
|
||||
UPSERT_POPULATE_RECLAIMS,
|
||||
);
|
||||
assert_eq!(1, account_maps_stats_len(&index));
|
||||
|
||||
|
@ -3380,7 +3379,7 @@ pub mod tests {
|
|||
&AccountSecondaryIndexes::default(),
|
||||
10,
|
||||
&mut gc,
|
||||
UPSERT_PREVIOUS_SLOT_ENTRY_WAS_CACHED_FALSE,
|
||||
UPSERT_POPULATE_RECLAIMS,
|
||||
);
|
||||
assert_eq!(1, account_maps_stats_len(&index));
|
||||
|
||||
|
@ -3400,7 +3399,7 @@ pub mod tests {
|
|||
&AccountSecondaryIndexes::default(),
|
||||
9,
|
||||
&mut gc,
|
||||
UPSERT_PREVIOUS_SLOT_ENTRY_WAS_CACHED_FALSE,
|
||||
UPSERT_POPULATE_RECLAIMS,
|
||||
);
|
||||
assert_eq!(1, account_maps_stats_len(&index));
|
||||
}
|
||||
|
@ -3482,7 +3481,7 @@ pub mod tests {
|
|||
secondary_indexes,
|
||||
true,
|
||||
&mut vec![],
|
||||
UPSERT_PREVIOUS_SLOT_ENTRY_WAS_CACHED_FALSE,
|
||||
UPSERT_POPULATE_RECLAIMS,
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -3656,7 +3655,7 @@ pub mod tests {
|
|||
&secondary_indexes,
|
||||
true,
|
||||
&mut vec![],
|
||||
UPSERT_PREVIOUS_SLOT_ENTRY_WAS_CACHED_FALSE,
|
||||
UPSERT_POPULATE_RECLAIMS,
|
||||
);
|
||||
assert!(secondary_index.index.is_empty());
|
||||
assert!(secondary_index.reverse_index.is_empty());
|
||||
|
@ -3670,7 +3669,7 @@ pub mod tests {
|
|||
&secondary_indexes,
|
||||
true,
|
||||
&mut vec![],
|
||||
UPSERT_PREVIOUS_SLOT_ENTRY_WAS_CACHED_FALSE,
|
||||
UPSERT_POPULATE_RECLAIMS,
|
||||
);
|
||||
assert!(secondary_index.index.is_empty());
|
||||
assert!(secondary_index.reverse_index.is_empty());
|
||||
|
@ -3794,7 +3793,7 @@ pub mod tests {
|
|||
secondary_indexes,
|
||||
true,
|
||||
&mut vec![],
|
||||
UPSERT_PREVIOUS_SLOT_ENTRY_WAS_CACHED_FALSE,
|
||||
UPSERT_POPULATE_RECLAIMS,
|
||||
);
|
||||
|
||||
// Now write a different mint index for the same account
|
||||
|
@ -3806,7 +3805,7 @@ pub mod tests {
|
|||
secondary_indexes,
|
||||
true,
|
||||
&mut vec![],
|
||||
UPSERT_PREVIOUS_SLOT_ENTRY_WAS_CACHED_FALSE,
|
||||
UPSERT_POPULATE_RECLAIMS,
|
||||
);
|
||||
|
||||
// Both pubkeys will now be present in the index
|
||||
|
@ -3826,7 +3825,7 @@ pub mod tests {
|
|||
secondary_indexes,
|
||||
true,
|
||||
&mut vec![],
|
||||
UPSERT_PREVIOUS_SLOT_ENTRY_WAS_CACHED_FALSE,
|
||||
UPSERT_POPULATE_RECLAIMS,
|
||||
);
|
||||
assert_eq!(secondary_index.get(&secondary_key1), vec![account_key]);
|
||||
|
||||
|
|
Loading…
Reference in New Issue