recover light client integration tests (#4377)

This commit is contained in:
Svyatoslav Nikolsky
2019-12-17 10:45:04 +03:00
committed by Bastian Köcher
parent 48860a768b
commit cd718cd77d
3 changed files with 8 additions and 32 deletions
+2 -8
View File
@@ -349,8 +349,7 @@ pub fn local_testnet_config() -> ChainSpec {
#[cfg(test)] #[cfg(test)]
pub(crate) mod tests { pub(crate) mod tests {
use super::*; use super::*;
use crate::service::new_full; use crate::service::{new_full, new_light};
use sc_service::Roles;
use sc_service_test; use sc_service_test;
fn local_testnet_genesis_instant_single() -> GenesisConfig { fn local_testnet_genesis_instant_single() -> GenesisConfig {
@@ -398,12 +397,7 @@ pub(crate) mod tests {
sc_service_test::connectivity( sc_service_test::connectivity(
integration_test_config_with_two_authorities(), integration_test_config_with_two_authorities(),
|config| new_full(config), |config| new_full(config),
|mut config| { |config| new_light(config),
// light nodes are unsupported
config.roles = Roles::FULL;
new_full(config)
},
true,
); );
} }
} }
+5 -17
View File
@@ -408,8 +408,8 @@ mod tests {
use sp_timestamp; use sp_timestamp;
use sp_finality_tracker; use sp_finality_tracker;
use sp_keyring::AccountKeyring; use sp_keyring::AccountKeyring;
use sc_service::{AbstractService, Roles}; use sc_service::AbstractService;
use crate::service::new_full; use crate::service::{new_full, new_light};
use sp_runtime::traits::IdentifyAccount; use sp_runtime::traits::IdentifyAccount;
type AccountPublic = <Signature as Verify>::Signer; type AccountPublic = <Signature as Verify>::Signer;
@@ -470,11 +470,7 @@ mod tests {
sc_service_test::sync( sc_service_test::sync(
sc_chain_spec::integration_test_config(), sc_chain_spec::integration_test_config(),
|config| new_full(config), |config| new_full(config),
|mut config| { |mut config| new_light(config),
// light nodes are unsupported
config.roles = Roles::FULL;
new_full(config)
},
block_factory, block_factory,
extrinsic_factory, extrinsic_factory,
); );
@@ -510,11 +506,7 @@ mod tests {
setup_handles = Some((block_import.clone(), babe_link.clone())); setup_handles = Some((block_import.clone(), babe_link.clone()));
}).map(move |(node, x)| (node, (x, setup_handles.unwrap()))) }).map(move |(node, x)| (node, (x, setup_handles.unwrap())))
}, },
|mut config| { |config| new_light(config),
// light nodes are unsupported
config.roles = Roles::FULL;
new_full(config)
},
|service, &mut (ref inherent_data_providers, (ref mut block_import, ref babe_link))| { |service, &mut (ref inherent_data_providers, (ref mut block_import, ref babe_link))| {
let mut inherent_data = inherent_data_providers let mut inherent_data = inherent_data_providers
.create_inherent_data() .create_inherent_data()
@@ -638,11 +630,7 @@ mod tests {
sc_service_test::consensus( sc_service_test::consensus(
crate::chain_spec::tests::integration_test_config_with_two_authorities(), crate::chain_spec::tests::integration_test_config_with_two_authorities(),
|config| new_full(config), |config| new_full(config),
|mut config| { |config| new_light(config),
// light nodes are unsupported
config.roles = Roles::FULL;
new_full(config)
},
vec![ vec![
"//Alice".into(), "//Alice".into(),
"//Bob".into(), "//Bob".into(),
+1 -7
View File
@@ -299,8 +299,6 @@ pub fn connectivity<G, E, Fb, F, Lb, L>(
spec: ChainSpec<G, E>, spec: ChainSpec<G, E>,
full_builder: Fb, full_builder: Fb,
light_builder: Lb, light_builder: Lb,
light_node_interconnectivity: bool, // should normally be false, unless the light nodes
// aren't actually light.
) where ) where
E: Clone, E: Clone,
Fb: Fn(Configuration<(), G, E>) -> Result<F, Error>, Fb: Fn(Configuration<(), G, E>) -> Result<F, Error>,
@@ -312,11 +310,7 @@ pub fn connectivity<G, E, Fb, F, Lb, L>(
const NUM_LIGHT_NODES: usize = 5; const NUM_LIGHT_NODES: usize = 5;
let expected_full_connections = NUM_FULL_NODES - 1 + NUM_LIGHT_NODES; let expected_full_connections = NUM_FULL_NODES - 1 + NUM_LIGHT_NODES;
let expected_light_connections = if light_node_interconnectivity { let expected_light_connections = NUM_FULL_NODES;
expected_full_connections
} else {
NUM_FULL_NODES
};
{ {
let temp = tempdir_with_prefix("substrate-connectivity-test"); let temp = tempdir_with_prefix("substrate-connectivity-test");