provisioner tests: remove tokio from dev-dependencies (#1745)

* provisioner: remove tokio from dev-dependencies

* provisioner: use futures_timer instead
This commit is contained in:
Andronik Ordian
2020-09-23 20:21:03 +02:00
committed by GitHub
parent 951024554d
commit f9b15f654b
3 changed files with 6 additions and 7 deletions
+4 -5
View File
@@ -648,6 +648,7 @@ mod tests {
}
mod select_candidates {
use futures_timer::Delay;
use super::super::*;
use super::{build_occupied_core, default_bitvec, occupied_core, scheduled_core};
use polkadot_node_subsystem::messages::RuntimeApiRequest::{
@@ -675,9 +676,7 @@ mod tests {
futures::pin_mut!(overseer, test);
tokio::runtime::Runtime::new()
.unwrap()
.block_on(future::select(overseer, test));
futures::executor::block_on(future::select(overseer, test));
}
// For test purposes, we always return this set of availability cores:
@@ -784,12 +783,12 @@ mod tests {
// drop the receiver so it closes and the sender can't send, then just sleep long enough that
// this is almost certainly not the first of the two futures to complete
std::mem::drop(rx);
tokio::time::delay_for(std::time::Duration::from_secs(1)).await;
Delay::new(std::time::Duration::from_secs(1)).await;
};
let test = |mut tx: mpsc::Sender<FromJob>| async move {
// wait so that the overseer can drop the rx before we attempt to send
tokio::time::delay_for(std::time::Duration::from_millis(50)).await;
Delay::new(std::time::Duration::from_millis(50)).await;
let result = select_candidates(&[], &[], &[], Default::default(), &mut tx).await;
println!("{:?}", result);
assert!(std::matches!(result, Err(Error::OneshotSend)));