Reduce the execution time of some tests (#10377)

* Reduce the execution time of some tests

* Fix

* Fix build

* fmt
This commit is contained in:
Kian Paimani
2021-11-28 13:47:33 +01:00
committed by GitHub
parent 1fed3540ba
commit 2fafb9546e
12 changed files with 68 additions and 229 deletions
@@ -309,16 +309,6 @@ pub trait BenchmarkingConfig {
const MAXIMUM_TARGETS: u32;
}
impl BenchmarkingConfig for () {
const VOTERS: [u32; 2] = [4000, 6000];
const TARGETS: [u32; 2] = [1000, 1600];
const ACTIVE_VOTERS: [u32; 2] = [1000, 3000];
const DESIRED_TARGETS: [u32; 2] = [400, 800];
const SNAPSHOT_MAXIMUM_VOTERS: u32 = 10_000;
const MINER_MAXIMUM_VOTERS: u32 = 10_000;
const MAXIMUM_TARGETS: u32 = 2_000;
}
/// A fallback implementation that transitions the pallet to the emergency phase.
pub struct NoFallback<T>(sp_std::marker::PhantomData<T>);
@@ -377,6 +377,19 @@ parameter_types! {
pub static Balancing: Option<(usize, ExtendedBalance)> = Some((0, 0));
}
pub struct TestBenchmarkingConfig;
impl BenchmarkingConfig for TestBenchmarkingConfig {
const VOTERS: [u32; 2] = [400, 600];
const ACTIVE_VOTERS: [u32; 2] = [100, 300];
const TARGETS: [u32; 2] = [200, 400];
const DESIRED_TARGETS: [u32; 2] = [100, 180];
const SNAPSHOT_MAXIMUM_VOTERS: u32 = 1000;
const MINER_MAXIMUM_VOTERS: u32 = 1000;
const MAXIMUM_TARGETS: u32 = 200;
}
impl crate::Config for Runtime {
type Event = Event;
type Currency = Balances;
@@ -398,7 +411,7 @@ impl crate::Config for Runtime {
type RewardHandler = ();
type DataProvider = StakingMock;
type WeightInfo = DualMockWeightInfo;
type BenchmarkingConfig = ();
type BenchmarkingConfig = TestBenchmarkingConfig;
type Fallback = MockFallback;
type ForceOrigin = frame_system::EnsureRoot<AccountId>;
type Solution = TestNposSolution;