Skip to content
Snippets Groups Projects
Unverified Commit 97fa922c authored by thiolliere's avatar thiolliere Committed by GitHub
Browse files

Refactor verbose test (#5506)

A test is triggering a log error. But is correct and successful. This is
a refactor without triggering the log error.
parent 9cf5e810
No related merge requests found
Pipeline #493504 waiting for manual action with stages
in 1 hour, 36 minutes, and 31 seconds
......@@ -27,6 +27,7 @@ use crate::{
System,
},
};
use codec::Decode;
use frame_support::traits::OnRuntimeUpgrade;
use pallet_migrations::WeightInfo as _;
......@@ -51,10 +52,18 @@ fn lazy_migration_works() {
let mut last_decodable = 0;
for block in 2..=65 {
run_to_block(block);
let mut decodable = 0;
for i in 0..1024 {
if crate::MyMap::<T>::get(i).is_some() {
let key = crate::MyMap::<T>::hashed_key_for(i);
let value =
frame_support::storage::unhashed::get_raw(&key[..]).expect("value exists");
if let Ok(value) = u64::decode(&mut &value[..]) {
assert_eq!(value, i as u64);
decodable += 1;
} else {
assert_eq!(u32::decode(&mut &value[..]).expect("not migrated yet"), i);
}
}
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment