Skip to content

Commit

Permalink
Increase the number of acounts used in randomized tests (#4661)
Browse files Browse the repository at this point in the history
# Motivation
As part of the security review with @roelstorms, it was considered that
we probably want to increase the number of accounts used in randomized
migration testing.

The number of accounts is a random number in the range 0..40. If we
migrate 20 accounts per step (increased from 10), half the time the
entire migration is completed in one step. (Plus a second step to point
the switch at the new database.) This gives insufficient opportunity for
the test to find any bugs.

# Changes
- Increase the number of accounts in randomized migration tests to a
random number in the range 0..100.

# Tests
- See CI

# Todos

- [ ] Add entry to changelog (if necessary).
  • Loading branch information
bitdivine authored Apr 3, 2024
1 parent f739a0a commit 0f68cf0
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions rs/backend/src/accounts_store/schema/proxy/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ where
// Check that the default storage is indeed a map.
assert!(accounts_db.schema_label() == SchemaLabel::Map);
// Insert some accounts
let number_of_accounts_to_migrate: u32 = rng.gen_range(0..40);
let number_of_accounts_to_migrate: u32 = rng.gen_range(0..100);
for _ in 0..number_of_accounts_to_migrate {
Operation::Insert.perform(&mut accounts_db, &mut reference_db, rng);
}
Expand All @@ -212,7 +212,7 @@ where
memory_manager.get(PartitionType::Accounts.memory_id()),
));
// Insert some accounts
let number_of_accounts_to_migrate: u32 = rng.gen_range(0..40);
let number_of_accounts_to_migrate: u32 = rng.gen_range(0..100);
for _ in 0..number_of_accounts_to_migrate {
Operation::Insert.perform(&mut accounts_db, &mut reference_db, rng);
}
Expand All @@ -231,7 +231,7 @@ where
let mut reference_db = AccountsDbAsProxy::default();
let new_accounts_db = AccountsDb::Map(AccountsDbAsMap::default());
// Insert some accounts
let number_of_accounts_to_migrate: u32 = rng.gen_range(0..40);
let number_of_accounts_to_migrate: u32 = rng.gen_range(0..100);
for _ in 0..number_of_accounts_to_migrate {
Operation::Insert.perform(&mut accounts_db, &mut reference_db, rng);
}
Expand Down

0 comments on commit 0f68cf0

Please sign in to comment.