Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Uses Bank::new_for_tests() instead of new_for_tests_with_config() #34587

Merged
merged 1 commit into from
Dec 26, 2023

Conversation

brooksprumo
Copy link
Contributor

Problem

A number of tests call Bank::new_for_tests_with_config() even though they don't use the test_config parameter at all. These could call Bank::new_for_tests() instead.

Summary of Changes

Replace new_for_tests_with_config() with new_for_tests().

@brooksprumo brooksprumo self-assigned this Dec 24, 2023
Copy link

codecov bot commented Dec 24, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (1a00175) 81.8% compared to head (823ad67) 81.8%.

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     

@brooksprumo brooksprumo marked this pull request as ready for review December 25, 2023 00:22
Comment on lines +116 to +117
let bank_forks =
BankForks::new_rw_arc(Bank::new_for_tests(&genesis_config_info.genesis_config));
Copy link
Contributor

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.

Copy link
Contributor Author

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();
Copy link
Contributor

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.

@brooksprumo brooksprumo merged commit 6b76ec1 into solana-labs:master Dec 26, 2023
35 checks passed
@brooksprumo brooksprumo deleted the ctor/bank/tests branch December 26, 2023 17:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants