mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-27 23:18:01 +00:00
Add try_state check to Pallet MessageQueue (#13502)
* feat: Add try_state for message_queue * Update frame/message-queue/src/lib.rs change if let to while let and modify bump_service_head function Co-authored-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * feat: update try_state, add checks for storage * fix: add try_state builder for remaining tests * Update frame/message-queue/src/mock.rs Co-authored-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * chore: assert statement to ensure * Fix tests Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * Use ensure instead of assert Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * Fix function signature and feature gate Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * Cleanup code Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> --------- Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> Co-authored-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> Co-authored-by: Juan <juangirini@gmail.com>
This commit is contained in:
@@ -295,10 +295,15 @@ where
|
||||
ext
|
||||
}
|
||||
|
||||
/// Run this closure in test externalities.
|
||||
pub fn test_closure<R>(f: impl FnOnce() -> R) -> R {
|
||||
let mut ext = new_test_ext::<Test>();
|
||||
ext.execute_with(f)
|
||||
/// Run the function pointer inside externalities and asserts the try_state hook at the end.
|
||||
pub fn build_and_execute<T: Config>(test: impl FnOnce() -> ())
|
||||
where
|
||||
BlockNumberFor<T>: From<u32>,
|
||||
{
|
||||
new_test_ext::<T>().execute_with(|| {
|
||||
test();
|
||||
MessageQueue::do_try_state().expect("All invariants must hold after a test");
|
||||
});
|
||||
}
|
||||
|
||||
/// Set the weight of a specific weight function.
|
||||
|
||||
Reference in New Issue
Block a user