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
+1 -1
View File
@@ -4965,13 +4965,13 @@ dependencies = [
"bitvec", "bitvec",
"derive_more 0.99.9", "derive_more 0.99.9",
"futures 0.3.5", "futures 0.3.5",
"futures-timer 3.0.2",
"lazy_static", "lazy_static",
"log 0.4.11", "log 0.4.11",
"polkadot-node-subsystem", "polkadot-node-subsystem",
"polkadot-node-subsystem-util", "polkadot-node-subsystem-util",
"polkadot-primitives", "polkadot-primitives",
"sp-core", "sp-core",
"tokio 0.2.21",
] ]
[[package]] [[package]]
+1 -1
View File
@@ -16,4 +16,4 @@ polkadot-node-subsystem-util = { path = "../../subsystem-util" }
[dev-dependencies] [dev-dependencies]
lazy_static = "1.4" lazy_static = "1.4"
sp-core = { git = "https://github.com/paritytech/substrate", branch = "master" } sp-core = { git = "https://github.com/paritytech/substrate", branch = "master" }
tokio = "0.2" futures-timer = "3.0.2"
+4 -5
View File
@@ -648,6 +648,7 @@ mod tests {
} }
mod select_candidates { mod select_candidates {
use futures_timer::Delay;
use super::super::*; use super::super::*;
use super::{build_occupied_core, default_bitvec, occupied_core, scheduled_core}; use super::{build_occupied_core, default_bitvec, occupied_core, scheduled_core};
use polkadot_node_subsystem::messages::RuntimeApiRequest::{ use polkadot_node_subsystem::messages::RuntimeApiRequest::{
@@ -675,9 +676,7 @@ mod tests {
futures::pin_mut!(overseer, test); futures::pin_mut!(overseer, test);
tokio::runtime::Runtime::new() futures::executor::block_on(future::select(overseer, test));
.unwrap()
.block_on(future::select(overseer, test));
} }
// For test purposes, we always return this set of availability cores: // 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 // 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 // this is almost certainly not the first of the two futures to complete
std::mem::drop(rx); 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 { let test = |mut tx: mpsc::Sender<FromJob>| async move {
// wait so that the overseer can drop the rx before we attempt to send // 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; let result = select_candidates(&[], &[], &[], Default::default(), &mut tx).await;
println!("{:?}", result); println!("{:?}", result);
assert!(std::matches!(result, Err(Error::OneshotSend))); assert!(std::matches!(result, Err(Error::OneshotSend)));