Skip to content
This repository was archived by the owner on Nov 15, 2023. It is now read-only.
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Updates test to commit the change before migration
  • Loading branch information
gupnik committed Apr 24, 2023
commit 063a1afa7dd7a730e727ec08674163a3cf3ad35c
10 changes: 8 additions & 2 deletions frame/offences/src/migration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -121,13 +121,19 @@ mod test {

#[test]
fn migration_to_v1_works() {
new_test_ext().execute_with(|| {
let mut ext = new_test_ext();

ext.execute_with(|| {
<v0::ReportsByKindIndex<T>>::insert(KIND, 2u32.encode());
assert!(<v0::ReportsByKindIndex<T>>::iter_values().count() > 0);
});

ext.commit_all().unwrap();

ext.execute_with(|| {
assert_eq!(
v1::MigrateToV1::<T>::on_runtime_upgrade(),
<T as frame_system::Config>::DbWeight::get().reads(1),
<T as frame_system::Config>::DbWeight::get().writes(1),
);

assert!(<v0::ReportsByKindIndex<T>>::iter_values().count() == 0);
Expand Down