diff --git a/Cargo.lock b/Cargo.lock index 0315b0864c43..fe521ba3de4c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4965,13 +4965,13 @@ dependencies = [ "bitvec", "derive_more 0.99.9", "futures 0.3.5", + "futures-timer 3.0.2", "lazy_static", "log 0.4.11", "polkadot-node-subsystem", "polkadot-node-subsystem-util", "polkadot-primitives", "sp-core", - "tokio 0.2.21", ] [[package]] diff --git a/node/core/provisioner/Cargo.toml b/node/core/provisioner/Cargo.toml index c391f8e45a77..38744704022f 100644 --- a/node/core/provisioner/Cargo.toml +++ b/node/core/provisioner/Cargo.toml @@ -16,4 +16,4 @@ polkadot-node-subsystem-util = { path = "../../subsystem-util" } [dev-dependencies] lazy_static = "1.4" sp-core = { git = "https://github.com/paritytech/substrate", branch = "master" } -tokio = "0.2" +futures-timer = "3.0.2" diff --git a/node/core/provisioner/src/lib.rs b/node/core/provisioner/src/lib.rs index 24254734289b..9449c99dadc6 100644 --- a/node/core/provisioner/src/lib.rs +++ b/node/core/provisioner/src/lib.rs @@ -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| 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)));