mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-27 04:37:57 +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:
@@ -21,21 +21,11 @@ use frame_support::{traits::OnInitialize, assert_ok};
|
||||
use sp_core::crypto::key_types::DUMMY;
|
||||
use sp_runtime::testing::UintAuthorityId;
|
||||
use mock::{
|
||||
NEXT_VALIDATORS, SESSION_CHANGED, TEST_SESSION_CHANGED, authorities, force_new_session,
|
||||
set_next_validators, set_session_length, session_changed, Test, Origin, System, Session,
|
||||
reset_before_session_end_called, before_session_end_called,
|
||||
SESSION_CHANGED, TEST_SESSION_CHANGED, authorities, force_new_session,
|
||||
set_next_validators, set_session_length, session_changed, Origin, System, Session,
|
||||
reset_before_session_end_called, before_session_end_called, new_test_ext,
|
||||
};
|
||||
|
||||
fn new_test_ext() -> sp_io::TestExternalities {
|
||||
let mut t = frame_system::GenesisConfig::default().build_storage::<Test>().unwrap();
|
||||
GenesisConfig::<Test> {
|
||||
keys: NEXT_VALIDATORS.with(|l|
|
||||
l.borrow().iter().cloned().map(|i| (i, i, UintAuthorityId(i).into())).collect()
|
||||
),
|
||||
}.assimilate_storage(&mut t).unwrap();
|
||||
sp_io::TestExternalities::new(t)
|
||||
}
|
||||
|
||||
fn initialize_block(block: u64) {
|
||||
SESSION_CHANGED.with(|l| *l.borrow_mut() = false);
|
||||
System::set_block_number(block);
|
||||
|
||||
Reference in New Issue
Block a user