mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-28 03:58:04 +00:00
tests: use future::join instead of future::select (#2813)
* tests/av-store: use future::join instead of future::select * tests/backing: use future::join instead of future::select * tests/provisioner: use future::join instead of future::select * tests/av-dist: use future::join instead of future::select * tests/av-recovery: use future::join instead of future::select * tests/bridge: use future::join instead of future::select * tests/collator-protocol: use future::join instead of future::select * tests/stmt-dist: use future::join instead of future::select * fix tests
This commit is contained in:
@@ -50,7 +50,7 @@ fn test_harness<T: Future<Output = ()>>(
|
||||
futures::pin_mut!(test_fut);
|
||||
futures::pin_mut!(subsystem);
|
||||
|
||||
executor::block_on(future::select(test_fut, subsystem));
|
||||
executor::block_on(future::join(test_fut, subsystem)).1.unwrap();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -50,8 +50,9 @@ use test_helpers::SingleItemSink;
|
||||
use super::mock::{make_session_info, OccupiedCoreBuilder, make_ferdie_keystore};
|
||||
use crate::LOG_TARGET;
|
||||
|
||||
type VirtualOverseer = test_helpers::TestSubsystemContextHandle<AvailabilityDistributionMessage>;
|
||||
pub struct TestHarness {
|
||||
pub virtual_overseer: test_helpers::TestSubsystemContextHandle<AvailabilityDistributionMessage>,
|
||||
pub virtual_overseer: VirtualOverseer,
|
||||
pub pool: TaskExecutor,
|
||||
}
|
||||
|
||||
@@ -161,7 +162,7 @@ impl TestState {
|
||||
///
|
||||
/// We try to be as agnostic about details as possible, how the subsystem achieves those goals
|
||||
/// should not be a matter to this test suite.
|
||||
async fn run_inner(mut self, executor: TaskExecutor, virtual_overseer: TestSubsystemContextHandle<AvailabilityDistributionMessage>) {
|
||||
async fn run_inner(mut self, executor: TaskExecutor, virtual_overseer: VirtualOverseer) {
|
||||
// We skip genesis here (in reality ActiveLeavesUpdate can also skip a block:
|
||||
let updates = {
|
||||
let mut advanced = self.relay_chain.iter();
|
||||
@@ -198,8 +199,7 @@ impl TestState {
|
||||
// cancel jobs as obsolete:
|
||||
Delay::new(Duration::from_millis(20)).await;
|
||||
}
|
||||
}.boxed()
|
||||
);
|
||||
}.boxed());
|
||||
|
||||
while remaining_stores > 0
|
||||
{
|
||||
@@ -211,11 +211,12 @@ impl TestState {
|
||||
// Forward requests:
|
||||
let in_req = to_incoming_req(&executor, req);
|
||||
|
||||
executor.spawn("Request forwarding",
|
||||
overseer_send(
|
||||
tx.clone(),
|
||||
AvailabilityDistributionMessage::ChunkFetchingRequest(in_req)
|
||||
).boxed()
|
||||
executor.spawn(
|
||||
"Request forwarding",
|
||||
overseer_send(
|
||||
tx.clone(),
|
||||
AvailabilityDistributionMessage::ChunkFetchingRequest(in_req)
|
||||
).boxed()
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -259,6 +260,8 @@ impl TestState {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
overseer_signal(tx, OverseerSignal::Conclude).await;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user