Tests for new network code (#897)

* move protocol.rs into subfolder

* add trait for mocking network behavior

* add a mock version of network ops

* remove some redundant parameters from service messages

* ensure fetching erasure chunks automatically cancels

* introduce dummy ProvideRuntimeApi

* abstract over gossip somewhat

* add mock gossip handler

* skeleton test

* remove dependence of shared table on router

* remove worker dependence on its own sender

* test shutdown

* add tests

* test that gossip streams are cleaned up correctly

* refactor worker out into its own struct and reduce bound on executor

* remove reliance of tests on global thread pool
This commit is contained in:
Robert Habermeier
2020-03-16 06:17:08 -04:00
committed by GitHub
parent a81d8cb220
commit 260b2fa336
5 changed files with 924 additions and 179 deletions
+1 -3
View File
@@ -197,7 +197,6 @@ impl<Client, TxPool, Backend> consensus::Proposer<Block> for Proposer<Client, Tx
parent_id,
client,
transaction_pool,
table,
inherent_data: Some(inherent_data),
inherent_digests,
// leave some time for the proposal finalisation
@@ -216,7 +215,7 @@ impl<Client, TxPool, Backend> consensus::Proposer<Block> for Proposer<Client, Tx
Delay::new(enough_candidates).await;
tokio::task::spawn_blocking(move || {
let proposed_candidates = data.table.proposed_set();
let proposed_candidates = table.proposed_set();
data.propose_with(proposed_candidates)
})
.await?
@@ -235,7 +234,6 @@ struct CreateProposalData<Client, TxPool, Backend> {
parent_id: BlockId,
client: Arc<Client>,
transaction_pool: Arc<TxPool>,
table: Arc<crate::SharedTable>,
inherent_data: Option<InherentData>,
inherent_digests: DigestFor<Block>,
deadline: Instant,