Accounts::new_with_config_for_tests (#19104)

This commit is contained in:
Jeff Washington (jwash) 2021-08-09 09:01:12 -05:00 committed by GitHub
parent 1951fe4e80
commit c7b986220e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 30 additions and 13 deletions

View File

@ -124,6 +124,23 @@ impl Accounts {
}
}
pub fn new_with_config_for_tests(
paths: Vec<PathBuf>,
cluster_type: &ClusterType,
account_indexes: AccountSecondaryIndexes,
caching_enabled: bool,
shrink_ratio: AccountShrinkThreshold,
) -> Self {
// will diverge
Self::new_with_config(
paths,
cluster_type,
account_indexes,
caching_enabled,
shrink_ratio,
)
}
pub fn new_with_config_for_benches(
paths: Vec<PathBuf>,
cluster_type: &ClusterType,
@ -1124,7 +1141,7 @@ mod tests {
) -> Vec<TransactionLoadResult> {
let mut hash_queue = BlockhashQueue::new(100);
hash_queue.register_hash(&tx.message().recent_blockhash, fee_calculator);
let accounts = Accounts::new_with_config(
let accounts = Accounts::new_with_config_for_tests(
Vec::new(),
&ClusterType::Development,
AccountSecondaryIndexes::default(),
@ -1662,7 +1679,7 @@ mod tests {
#[test]
fn test_load_by_program_slot() {
let accounts = Accounts::new_with_config(
let accounts = Accounts::new_with_config_for_tests(
Vec::new(),
&ClusterType::Development,
AccountSecondaryIndexes::default(),
@ -1691,7 +1708,7 @@ mod tests {
#[test]
fn test_accounts_account_not_found() {
let accounts = Accounts::new_with_config(
let accounts = Accounts::new_with_config_for_tests(
Vec::new(),
&ClusterType::Development,
AccountSecondaryIndexes::default(),
@ -1715,7 +1732,7 @@ mod tests {
#[test]
#[should_panic]
fn test_accounts_empty_bank_hash() {
let accounts = Accounts::new_with_config(
let accounts = Accounts::new_with_config_for_tests(
Vec::new(),
&ClusterType::Development,
AccountSecondaryIndexes::default(),
@ -1737,7 +1754,7 @@ mod tests {
let account2 = AccountSharedData::new(3, 0, &Pubkey::default());
let account3 = AccountSharedData::new(4, 0, &Pubkey::default());
let accounts = Accounts::new_with_config(
let accounts = Accounts::new_with_config_for_tests(
Vec::new(),
&ClusterType::Development,
AccountSecondaryIndexes::default(),
@ -1847,7 +1864,7 @@ mod tests {
let account1 = AccountSharedData::new(2, 0, &Pubkey::default());
let account2 = AccountSharedData::new(3, 0, &Pubkey::default());
let accounts = Accounts::new_with_config(
let accounts = Accounts::new_with_config_for_tests(
Vec::new(),
&ClusterType::Development,
AccountSecondaryIndexes::default(),
@ -1986,7 +2003,7 @@ mod tests {
let mut loaded = vec![loaded0, loaded1];
let accounts = Accounts::new_with_config(
let accounts = Accounts::new_with_config_for_tests(
Vec::new(),
&ClusterType::Development,
AccountSecondaryIndexes::default(),
@ -2034,7 +2051,7 @@ mod tests {
#[test]
fn huge_clean() {
solana_logger::setup();
let accounts = Accounts::new_with_config(
let accounts = Accounts::new_with_config_for_tests(
Vec::new(),
&ClusterType::Development,
AccountSecondaryIndexes::default(),
@ -2082,7 +2099,7 @@ mod tests {
#[test]
fn test_instructions() {
solana_logger::setup();
let accounts = Accounts::new_with_config(
let accounts = Accounts::new_with_config_for_tests(
Vec::new(),
&ClusterType::Development,
AccountSecondaryIndexes::default(),
@ -2371,7 +2388,7 @@ mod tests {
let mut loaded = vec![loaded];
let next_blockhash = Hash::new_unique();
let accounts = Accounts::new_with_config(
let accounts = Accounts::new_with_config_for_tests(
Vec::new(),
&ClusterType::Development,
AccountSecondaryIndexes::default(),
@ -2488,7 +2505,7 @@ mod tests {
let mut loaded = vec![loaded];
let next_blockhash = Hash::new_unique();
let accounts = Accounts::new_with_config(
let accounts = Accounts::new_with_config_for_tests(
Vec::new(),
&ClusterType::Development,
AccountSecondaryIndexes::default(),
@ -2524,7 +2541,7 @@ mod tests {
#[test]
fn test_load_largest_accounts() {
let accounts = Accounts::new_with_config(
let accounts = Accounts::new_with_config_for_tests(
Vec::new(),
&ClusterType::Development,
AccountSecondaryIndexes::default(),

View File

@ -131,7 +131,7 @@ where
fn test_accounts_serialize_style(serde_style: SerdeStyle) {
solana_logger::setup();
let (_accounts_dir, paths) = get_temp_accounts_paths(4).unwrap();
let accounts = Accounts::new_with_config(
let accounts = Accounts::new_with_config_for_tests(
paths,
&ClusterType::Development,
AccountSecondaryIndexes::default(),