-
Notifications
You must be signed in to change notification settings - Fork 4.6k
Uses Bank::new_for_tests() instead of new_for_tests_with_config() #34587
Conversation
cd19d15
to
823ad67
Compare
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #34587 +/- ##
=========================================
- Coverage 81.8% 81.8% -0.1%
=========================================
Files 824 824
Lines 222153 222148 -5
=========================================
- Hits 181803 181776 -27
- Misses 40350 40372 +22 |
let bank_forks = | ||
BankForks::new_rw_arc(Bank::new_for_tests(&genesis_config_info.genesis_config)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is a function called Bank::new_with_bank_forks_for_tests
that does exactly this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep! I have follow up PRs planned for more refactors to consolidate the constructors.
I prefer these simpler PR with a single change. It's easy to see they are all the same. And this is correct as is.
@@ -2130,8 +2130,7 @@ fn test_purge_empty_accounts() { | |||
let (genesis_config, mint_keypair) = create_genesis_config(sol_to_lamports(1.)); | |||
let amount = genesis_config.rent.minimum_balance(0); | |||
let (mut bank, bank_forks) = | |||
Bank::new_for_tests_with_config(&genesis_config, BankTestConfig::default()) | |||
.wrap_with_bank_forks_for_tests(); | |||
Bank::new_for_tests(&genesis_config).wrap_with_bank_forks_for_tests(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bank::new_with_bank_forks_for_tests
does this as well.
Problem
A number of tests call
Bank::new_for_tests_with_config()
even though they don't use thetest_config
parameter at all. These could callBank::new_for_tests()
instead.Summary of Changes
Replace
new_for_tests_with_config()
withnew_for_tests()
.