Accounts::new_with_config_for_tests (#19104)
This commit is contained in:
parent
1951fe4e80
commit
c7b986220e
|
@ -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(
|
pub fn new_with_config_for_benches(
|
||||||
paths: Vec<PathBuf>,
|
paths: Vec<PathBuf>,
|
||||||
cluster_type: &ClusterType,
|
cluster_type: &ClusterType,
|
||||||
|
@ -1124,7 +1141,7 @@ mod tests {
|
||||||
) -> Vec<TransactionLoadResult> {
|
) -> Vec<TransactionLoadResult> {
|
||||||
let mut hash_queue = BlockhashQueue::new(100);
|
let mut hash_queue = BlockhashQueue::new(100);
|
||||||
hash_queue.register_hash(&tx.message().recent_blockhash, fee_calculator);
|
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(),
|
Vec::new(),
|
||||||
&ClusterType::Development,
|
&ClusterType::Development,
|
||||||
AccountSecondaryIndexes::default(),
|
AccountSecondaryIndexes::default(),
|
||||||
|
@ -1662,7 +1679,7 @@ mod tests {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_load_by_program_slot() {
|
fn test_load_by_program_slot() {
|
||||||
let accounts = Accounts::new_with_config(
|
let accounts = Accounts::new_with_config_for_tests(
|
||||||
Vec::new(),
|
Vec::new(),
|
||||||
&ClusterType::Development,
|
&ClusterType::Development,
|
||||||
AccountSecondaryIndexes::default(),
|
AccountSecondaryIndexes::default(),
|
||||||
|
@ -1691,7 +1708,7 @@ mod tests {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_accounts_account_not_found() {
|
fn test_accounts_account_not_found() {
|
||||||
let accounts = Accounts::new_with_config(
|
let accounts = Accounts::new_with_config_for_tests(
|
||||||
Vec::new(),
|
Vec::new(),
|
||||||
&ClusterType::Development,
|
&ClusterType::Development,
|
||||||
AccountSecondaryIndexes::default(),
|
AccountSecondaryIndexes::default(),
|
||||||
|
@ -1715,7 +1732,7 @@ mod tests {
|
||||||
#[test]
|
#[test]
|
||||||
#[should_panic]
|
#[should_panic]
|
||||||
fn test_accounts_empty_bank_hash() {
|
fn test_accounts_empty_bank_hash() {
|
||||||
let accounts = Accounts::new_with_config(
|
let accounts = Accounts::new_with_config_for_tests(
|
||||||
Vec::new(),
|
Vec::new(),
|
||||||
&ClusterType::Development,
|
&ClusterType::Development,
|
||||||
AccountSecondaryIndexes::default(),
|
AccountSecondaryIndexes::default(),
|
||||||
|
@ -1737,7 +1754,7 @@ mod tests {
|
||||||
let account2 = AccountSharedData::new(3, 0, &Pubkey::default());
|
let account2 = AccountSharedData::new(3, 0, &Pubkey::default());
|
||||||
let account3 = AccountSharedData::new(4, 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(),
|
Vec::new(),
|
||||||
&ClusterType::Development,
|
&ClusterType::Development,
|
||||||
AccountSecondaryIndexes::default(),
|
AccountSecondaryIndexes::default(),
|
||||||
|
@ -1847,7 +1864,7 @@ mod tests {
|
||||||
let account1 = AccountSharedData::new(2, 0, &Pubkey::default());
|
let account1 = AccountSharedData::new(2, 0, &Pubkey::default());
|
||||||
let account2 = AccountSharedData::new(3, 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(),
|
Vec::new(),
|
||||||
&ClusterType::Development,
|
&ClusterType::Development,
|
||||||
AccountSecondaryIndexes::default(),
|
AccountSecondaryIndexes::default(),
|
||||||
|
@ -1986,7 +2003,7 @@ mod tests {
|
||||||
|
|
||||||
let mut loaded = vec![loaded0, loaded1];
|
let mut loaded = vec![loaded0, loaded1];
|
||||||
|
|
||||||
let accounts = Accounts::new_with_config(
|
let accounts = Accounts::new_with_config_for_tests(
|
||||||
Vec::new(),
|
Vec::new(),
|
||||||
&ClusterType::Development,
|
&ClusterType::Development,
|
||||||
AccountSecondaryIndexes::default(),
|
AccountSecondaryIndexes::default(),
|
||||||
|
@ -2034,7 +2051,7 @@ mod tests {
|
||||||
#[test]
|
#[test]
|
||||||
fn huge_clean() {
|
fn huge_clean() {
|
||||||
solana_logger::setup();
|
solana_logger::setup();
|
||||||
let accounts = Accounts::new_with_config(
|
let accounts = Accounts::new_with_config_for_tests(
|
||||||
Vec::new(),
|
Vec::new(),
|
||||||
&ClusterType::Development,
|
&ClusterType::Development,
|
||||||
AccountSecondaryIndexes::default(),
|
AccountSecondaryIndexes::default(),
|
||||||
|
@ -2082,7 +2099,7 @@ mod tests {
|
||||||
#[test]
|
#[test]
|
||||||
fn test_instructions() {
|
fn test_instructions() {
|
||||||
solana_logger::setup();
|
solana_logger::setup();
|
||||||
let accounts = Accounts::new_with_config(
|
let accounts = Accounts::new_with_config_for_tests(
|
||||||
Vec::new(),
|
Vec::new(),
|
||||||
&ClusterType::Development,
|
&ClusterType::Development,
|
||||||
AccountSecondaryIndexes::default(),
|
AccountSecondaryIndexes::default(),
|
||||||
|
@ -2371,7 +2388,7 @@ mod tests {
|
||||||
let mut loaded = vec![loaded];
|
let mut loaded = vec![loaded];
|
||||||
|
|
||||||
let next_blockhash = Hash::new_unique();
|
let next_blockhash = Hash::new_unique();
|
||||||
let accounts = Accounts::new_with_config(
|
let accounts = Accounts::new_with_config_for_tests(
|
||||||
Vec::new(),
|
Vec::new(),
|
||||||
&ClusterType::Development,
|
&ClusterType::Development,
|
||||||
AccountSecondaryIndexes::default(),
|
AccountSecondaryIndexes::default(),
|
||||||
|
@ -2488,7 +2505,7 @@ mod tests {
|
||||||
let mut loaded = vec![loaded];
|
let mut loaded = vec![loaded];
|
||||||
|
|
||||||
let next_blockhash = Hash::new_unique();
|
let next_blockhash = Hash::new_unique();
|
||||||
let accounts = Accounts::new_with_config(
|
let accounts = Accounts::new_with_config_for_tests(
|
||||||
Vec::new(),
|
Vec::new(),
|
||||||
&ClusterType::Development,
|
&ClusterType::Development,
|
||||||
AccountSecondaryIndexes::default(),
|
AccountSecondaryIndexes::default(),
|
||||||
|
@ -2524,7 +2541,7 @@ mod tests {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_load_largest_accounts() {
|
fn test_load_largest_accounts() {
|
||||||
let accounts = Accounts::new_with_config(
|
let accounts = Accounts::new_with_config_for_tests(
|
||||||
Vec::new(),
|
Vec::new(),
|
||||||
&ClusterType::Development,
|
&ClusterType::Development,
|
||||||
AccountSecondaryIndexes::default(),
|
AccountSecondaryIndexes::default(),
|
||||||
|
|
|
@ -131,7 +131,7 @@ where
|
||||||
fn test_accounts_serialize_style(serde_style: SerdeStyle) {
|
fn test_accounts_serialize_style(serde_style: SerdeStyle) {
|
||||||
solana_logger::setup();
|
solana_logger::setup();
|
||||||
let (_accounts_dir, paths) = get_temp_accounts_paths(4).unwrap();
|
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,
|
paths,
|
||||||
&ClusterType::Development,
|
&ClusterType::Development,
|
||||||
AccountSecondaryIndexes::default(),
|
AccountSecondaryIndexes::default(),
|
||||||
|
|
Loading…
Reference in New Issue