-
Notifications
You must be signed in to change notification settings - Fork 4.4k
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
Puts create_tmp_accounts_dir_for_tests() behind DCOU #34022
Puts create_tmp_accounts_dir_for_tests() behind DCOU #34022
Conversation
ec8b9e9
to
e084ec9
Compare
Codecov Report
@@ Coverage Diff @@
## master #34022 +/- ##
=========================================
- Coverage 81.9% 81.9% -0.1%
=========================================
Files 811 811
Lines 219427 219429 +2
=========================================
- Hits 179813 179754 -59
- Misses 39614 39675 +61 |
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.
One nit, but don't think it should block pushing the PR if you feel differently
@@ -1999,7 +1997,9 @@ pub fn verify_snapshot_archive( | |||
) { | |||
let temp_dir = tempfile::TempDir::new().unwrap(); | |||
let unpack_dir = temp_dir.path(); | |||
let unpack_account_dir = create_accounts_run_and_snapshot_dirs(unpack_dir).unwrap().0; | |||
let unpack_account_dir = accounts_db::create_accounts_run_and_snapshot_dirs(unpack_dir) |
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.
nit: I've found the tuple indexing to be kind of tricky sometimes. Doing the full de-structure is a bit more explicit:
let (unpack_account_dir, _snapshot_dir) = ...
This isn't perfect either as someone could still swap the order of the return types without breaking anything. I guess a struct with names fields, and unpacking by named field would be the only way to fully protect against this.
In any case, feel free to change or ignore; certainly don't want to punish the good deed of restricting access to the test only function
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.
Lol, missed that you added auto-merge
label. Like I said, I was fine pushing as-is anyways
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.
Yeah, tuples aren't the most explicit. I agree with you, I think destructing is probably the better call.
Problem
create_tmp_accounts_dir_for_tests()
is used by tests to create a temp "accounts path" directory. But nothing is stopping a non-test from calling it...Summary of Changes
...until now! Put it behind DCOU.
(and give the function some documentation too, for good measure)