-
Notifications
You must be signed in to change notification settings - Fork 4.7k
Move `serde-snapshot dependent accounts-db tests #32671
Conversation
4d2852d
to
fc3b349
Compare
fc3b349
to
46784ef
Compare
Codecov Report
@@ Coverage Diff @@
## master #32671 +/- ##
=======================================
Coverage 82.0% 82.0%
=======================================
Files 785 785
Lines 211100 211095 -5
=======================================
+ Hits 173170 173180 +10
+ Misses 37930 37915 -15 |
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.
I'll audit the tests; maybe some of the functions/fields don't need to be made public, and instead the tests can be tweaked.
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.
Looks good overall.
For the code that was moved to runtime/src/serde_snapshot/tests.rs
, can you point out any code that was altered from when it was in accounts_db.rs
? I would assume "nothing", but maybe there's a few functions that needed to be made public?
// a number of test cases in accounts_db use this | ||
#[cfg(test)] | ||
pub(crate) use tests::reconstruct_accounts_db_via_serialization; |
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.
🎉
pub accounts_delta_hashes: Mutex<HashMap<Slot, AccountsDeltaHash>>, | ||
pub accounts_hashes: Mutex<HashMap<Slot, (AccountsHash, /*capitalization*/ u64)>>, |
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.
I can address these fields in a subsequent PR. For reference, I'll be using dev-context-only-utils
, and it'll look something like this: #32718
@@ -9385,7 +9385,7 @@ impl AccountsDb { | |||
}); | |||
} | |||
|
|||
fn print_count_and_status(&self, label: &str) { | |||
pub fn print_count_and_status(&self, label: &str) { |
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.
Looks like this is the only non-test-exclusive function that was made public.
The function that calls it, print_account_stats()
, is already public, and Bank has an entrypoint for it that's also public. That version is also mostly used in tests, except for one usage in ledger-tool.
I'm not sure tests need to print out this information, but it doesn't hurt. I imagine it was added initially for debugging.
Seems fine to make public.
Yes, no other functional changes were made, besides making the tests compile in the new location. So some imports fixups and public 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.
lgtm
Problem
Some
accounts-db
unit tests depend onserde-snapshot
. Withruntime
crate refactor, these tests ends up causing circular dependency between runtime and accounts-db crates.Summary of Changes
Move the tests to
serde-snapshot
tests. This will allow these tests to have dependency on runtime as well as accounts-db.Fixes #