Skip to content

Commit

Permalink
add test for on_initialize_with_bump_era to ensure the weight within …
Browse files Browse the repository at this point in the history
…block weight limit
  • Loading branch information
xlc committed Oct 14, 2024
1 parent fa648e1 commit 7ce4796
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 2 deletions.
2 changes: 0 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
cargo-features = ["resolver"]

[workspace]
members = [
"modules/*",
Expand Down
10 changes: 10 additions & 0 deletions runtime/acala/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2719,4 +2719,14 @@ mod tests {
If the limit is too strong, maybe consider increasing the limit",
);
}

#[test]
fn check_on_initialize_with_bump_era_weight() {
use module_homa::WeightInfo;
let weight = weights::module_homa::WeightInfo::<Runtime>::on_initialize_with_bump_era(
<Runtime as module_homa::Config>::ProcessRedeemRequestsLimit::get(),
);
let block_weight = RuntimeBlockWeights::get().max_block.div(3).mul(2);
assert!(weight.all_lt(block_weight));
}
}
10 changes: 10 additions & 0 deletions runtime/karura/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2752,4 +2752,14 @@ mod tests {
If the limit is too strong, maybe consider increasing the limit",
);
}

#[test]
fn check_on_initialize_with_bump_era_weight() {
use module_homa::WeightInfo;
let weight = weights::module_homa::WeightInfo::<Runtime>::on_initialize_with_bump_era(
<Runtime as module_homa::Config>::ProcessRedeemRequestsLimit::get(),
);
let block_weight = RuntimeBlockWeights::get().max_block.div(3).mul(2);
assert!(weight.all_lt(block_weight));
}
}

0 comments on commit 7ce4796

Please sign in to comment.