mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-13 14:01:06 +00:00
Generate Unit Tests for Benchmarks (#5527)
* Update to latest staking * generate tests for benchmarking * add tests, fix warnings * starting on democracy * impl_benchmark_tests * Way more readable * add test feature flag (does this work?) * Fix `successful_origin` impl * democracry benchmark tests * Fix example benchmarks, add tests * identity benchmark tests * Update im-online benchmark tests * try to add session benchmarking tests (problem with mock) * staking and timestamp * add test for treasury, issue with dynamic contains * utility * Vesting * test instead of check * hide until we figure out what is wrong * add docs * close code * Create custom mock for session-pallet-benchmarking * Use refcell pattern * make un-pub * test-linux-stable includes `runtime-benchmarks` feature * Revert "test-linux-stable includes `runtime-benchmarks` feature" This reverts commit a2dab38abd18ac3eb8a6220e4a00e687740bd38c. * run tests in `--release` * undo balance change * build wasm
This commit is contained in:
@@ -146,3 +146,24 @@ benchmarks! {
|
||||
Utility::<T>::as_multi(RawOrigin::Signed(caller.clone()).into(), s as u16, signatories.clone(), None, call.clone())?;
|
||||
}: _(RawOrigin::Signed(caller), s as u16, signatories, timepoint, call_hash)
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
use crate::tests::{new_test_ext, Test};
|
||||
use frame_support::assert_ok;
|
||||
|
||||
#[test]
|
||||
fn test_benchmarks() {
|
||||
new_test_ext().execute_with(|| {
|
||||
assert_ok!(test_benchmark_batch::<Test>());
|
||||
assert_ok!(test_benchmark_as_sub::<Test>());
|
||||
assert_ok!(test_benchmark_as_multi_create::<Test>());
|
||||
assert_ok!(test_benchmark_as_multi_approve::<Test>());
|
||||
assert_ok!(test_benchmark_as_multi_complete::<Test>());
|
||||
assert_ok!(test_benchmark_approve_as_multi_create::<Test>());
|
||||
assert_ok!(test_benchmark_approve_as_multi_approve::<Test>());
|
||||
assert_ok!(test_benchmark_cancel_as_multi::<Test>());
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -109,7 +109,7 @@ type Utility = Module<Test>;
|
||||
use pallet_balances::Call as BalancesCall;
|
||||
use pallet_balances::Error as BalancesError;
|
||||
|
||||
fn new_test_ext() -> sp_io::TestExternalities {
|
||||
pub fn new_test_ext() -> sp_io::TestExternalities {
|
||||
let mut t = frame_system::GenesisConfig::default().build_storage::<Test>().unwrap();
|
||||
pallet_balances::GenesisConfig::<Test> {
|
||||
balances: vec![(1, 10), (2, 10), (3, 10), (4, 10), (5, 10)],
|
||||
|
||||
Reference in New Issue
Block a user