break out subsystem-util and subsystem-test-helpers into individual crates (#1553)

* break out subsystem-util and subsystem-test-helpers into individual crates

* cause all packages to check successfully
This commit is contained in:
Peter Goodspeed-Niklaus
2020-08-07 16:51:36 +02:00
committed by GitHub
parent 21cec309a4
commit 9fda6cb416
32 changed files with 212 additions and 97 deletions
+1 -1
View File
@@ -19,6 +19,6 @@ derive_more = "0.99.9"
[dev-dependencies]
sp-core = { git = "https://github.com/paritytech/substrate", branch = "master" }
futures = { version = "0.3.5", features = ["thread-pool"] }
polkadot-subsystem = { package = "polkadot-node-subsystem", path = "../../subsystem", features = [ "test-helpers" ] }
polkadot-node-subsystem-test-helpers = { path = "../../subsystem-test-helpers" }
kvdb-memorydb = "0.7.0"
assert_matches = "1.3.0"
+1 -1
View File
@@ -316,7 +316,7 @@ mod tests {
AvailableData, BlockData, HeadData, GlobalValidationData, LocalValidationData, PoV,
OmittedValidationData,
};
use polkadot_subsystem::test_helpers;
use polkadot_node_subsystem_test_helpers as test_helpers;
struct TestHarness {
virtual_overseer: test_helpers::TestSubsystemContextHandle<AvailabilityStoreMessage>,
+2 -1
View File
@@ -13,6 +13,7 @@ keystore = { package = "sc-keystore", git = "https://github.com/paritytech/subst
polkadot-primitives = { path = "../../../primitives" }
polkadot-node-primitives = { path = "../../primitives" }
polkadot-subsystem = { package = "polkadot-node-subsystem", path = "../../subsystem" }
polkadot-node-subsystem-util = { path = "../../subsystem-util" }
erasure-coding = { package = "polkadot-erasure-coding", path = "../../../erasure-coding" }
statement-table = { package = "polkadot-statement-table", path = "../../../statement-table" }
derive_more = "0.99.9"
@@ -24,4 +25,4 @@ sp-core = { git = "https://github.com/paritytech/substrate", branch = "master" }
sp-keyring = { git = "https://github.com/paritytech/substrate", branch = "master" }
futures = { version = "0.3.5", features = ["thread-pool"] }
assert_matches = "1.3.0"
polkadot-subsystem = { package = "polkadot-node-subsystem", path = "../../subsystem", features = [ "test-helpers" ] }
polkadot-node-subsystem-test-helpers = { path = "../../subsystem-test-helpers" }
+11 -11
View File
@@ -45,14 +45,14 @@ use polkadot_subsystem::{
ProvisionerMessage, RuntimeApiMessage, StatementDistributionMessage, ValidationFailed,
RuntimeApiRequest,
},
util::{
self,
request_session_index_for_child,
request_validator_groups,
request_validators,
request_from_runtime,
Validator,
},
};
use polkadot_node_subsystem_util::{
self as util,
request_session_index_for_child,
request_validator_groups,
request_validators,
request_from_runtime,
Validator,
delegated_subsystem,
};
use statement_table::{
@@ -896,13 +896,13 @@ mod tests {
}
struct TestHarness {
virtual_overseer: polkadot_subsystem::test_helpers::TestSubsystemContextHandle<CandidateBackingMessage>,
virtual_overseer: polkadot_node_subsystem_test_helpers::TestSubsystemContextHandle<CandidateBackingMessage>,
}
fn test_harness<T: Future<Output=()>>(keystore: KeyStorePtr, test: impl FnOnce(TestHarness) -> T) {
let pool = sp_core::testing::TaskExecutor::new();
let (context, virtual_overseer) = polkadot_subsystem::test_helpers::make_subsystem_context(pool.clone());
let (context, virtual_overseer) = polkadot_node_subsystem_test_helpers::make_subsystem_context(pool.clone());
let subsystem = CandidateBackingSubsystem::run(context, keystore, pool.clone());
@@ -960,7 +960,7 @@ mod tests {
// Tests that the subsystem performs actions that are requied on startup.
async fn test_startup(
virtual_overseer: &mut polkadot_subsystem::test_helpers::TestSubsystemContextHandle<CandidateBackingMessage>,
virtual_overseer: &mut polkadot_node_subsystem_test_helpers::TestSubsystemContextHandle<CandidateBackingMessage>,
test_state: &TestState,
) {
// Start work on some new parent.
@@ -11,5 +11,6 @@ futures = "0.3.5"
log = "0.4.8"
polkadot-primitives = { path = "../../../primitives" }
polkadot-node-subsystem = { path = "../../subsystem" }
polkadot-node-subsystem-util = { path = "../../subsystem-util" }
keystore = { package = "sc-keystore", git = "https://github.com/paritytech/substrate", branch = "master" }
wasm-timer = "0.2.4"
@@ -29,7 +29,9 @@ use polkadot_node_subsystem::{
BitfieldSigningMessage, CandidateBackingMessage, RuntimeApiMessage,
},
errors::RuntimeApiError,
util::{self, JobManager, JobTrait, ToJobTrait, Validator},
};
use polkadot_node_subsystem_util::{
self as util, JobManager, JobTrait, ToJobTrait, Validator
};
use polkadot_primitives::v1::{AvailabilityBitfield, CoreState, Hash, ValidatorIndex};
use std::{convert::TryFrom, pin::Pin, time::Duration};
@@ -21,4 +21,4 @@ log = "0.4.8"
sp-keyring = { git = "https://github.com/paritytech/substrate", branch = "master" }
futures = { version = "0.3.5", features = ["thread-pool"] }
assert_matches = "1.3.0"
polkadot-subsystem = { package = "polkadot-node-subsystem", path = "../../subsystem", features = ["test-helpers"] }
polkadot-node-subsystem-test-helpers = { path = "../../subsystem-test-helpers" }
@@ -470,7 +470,7 @@ fn validate_candidate_exhaustive<B: ValidationBackend, S: SpawnNamed + 'static>(
#[cfg(test)]
mod tests {
use super::*;
use polkadot_subsystem::test_helpers;
use polkadot_node_subsystem_test_helpers as test_helpers;
use polkadot_primitives::v1::{HeadData, BlockData};
use sp_core::testing::TaskExecutor;
use futures::executor;
+1 -1
View File
@@ -13,5 +13,5 @@ polkadot-subsystem = { package = "polkadot-node-subsystem", path = "../../subsys
[dev-dependencies]
futures = { version = "0.3.5", features = ["thread-pool"] }
maplit = "1.0.2"
polkadot-subsystem = { package = "polkadot-node-subsystem", path = "../../subsystem", features = ["test-helpers"] }
polkadot-node-subsystem-test-helpers = { path = "../../subsystem-test-helpers" }
sp-core = { git = "https://github.com/paritytech/substrate", branch = "master" }
+1 -1
View File
@@ -121,7 +121,7 @@ mod tests {
use futures::{future::BoxFuture, channel::oneshot};
use polkadot_primitives::v1::{Hash, BlockNumber, BlockId, Header};
use polkadot_subsystem::test_helpers::{make_subsystem_context, TestSubsystemContextHandle};
use polkadot_node_subsystem_test_helpers::{make_subsystem_context, TestSubsystemContextHandle};
use sp_blockchain::Info as BlockInfo;
use sp_core::testing::TaskExecutor;
@@ -11,6 +11,7 @@ futures = "0.3.5"
log = "0.4.8"
polkadot-primitives = { path = "../../../primitives" }
polkadot-node-subsystem = { path = "../../subsystem" }
polkadot-node-subsystem-util = { path = "../../subsystem-util" }
[dev-dependencies]
lazy_static = "1.4"
+6 -5
View File
@@ -25,16 +25,17 @@ use futures::{
prelude::*,
};
use polkadot_node_subsystem::{
delegated_subsystem,
errors::{ChainApiError, RuntimeApiError},
messages::{
AllMessages, ChainApiMessage, ProvisionableData, ProvisionerInherentData,
ProvisionerMessage, RuntimeApiMessage,
},
util::{
self, request_availability_cores, request_global_validation_data,
request_local_validation_data, JobTrait, ToJobTrait,
},
};
use polkadot_node_subsystem_util::{
self as util,
delegated_subsystem,
request_availability_cores, request_global_validation_data,
request_local_validation_data, JobTrait, ToJobTrait,
};
use polkadot_primitives::v1::{
validation_data_hash, BackedCandidate, BlockNumber, CoreState, Hash, OccupiedCoreAssumption,
+1 -1
View File
@@ -16,4 +16,4 @@ polkadot-subsystem = { package = "polkadot-node-subsystem", path = "../../subsys
[dev-dependencies]
sp-core = { git = "https://github.com/paritytech/substrate", branch = "master" }
futures = { version = "0.3.5", features = ["thread-pool"] }
polkadot-subsystem = { package = "polkadot-node-subsystem", path = "../../subsystem", features = ["test-helpers"] }
polkadot-node-subsystem-test-helpers = { path = "../../subsystem-test-helpers" }
+1 -1
View File
@@ -123,7 +123,7 @@ mod tests {
Id as ParaId, OccupiedCoreAssumption, LocalValidationData, SessionIndex, ValidationCode,
CommittedCandidateReceipt, CandidateEvent,
};
use polkadot_subsystem::test_helpers;
use polkadot_node_subsystem_test_helpers as test_helpers;
use sp_core::testing::TaskExecutor;
use std::collections::HashMap;