Skip to content
This repository was archived by the owner on Nov 15, 2023. It is now read-only.

Commit 3b37ea6

Browse files
authored
provisioner tests: remove tokio from dev-dependencies (#1745)
* provisioner: remove tokio from dev-dependencies * provisioner: use futures_timer instead
1 parent a5d776a commit 3b37ea6

File tree

3 files changed

+6
-7
lines changed

3 files changed

+6
-7
lines changed

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

node/core/provisioner/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,4 @@ polkadot-node-subsystem-util = { path = "../../subsystem-util" }
1616
[dev-dependencies]
1717
lazy_static = "1.4"
1818
sp-core = { git = "https://github.com/paritytech/substrate", branch = "master" }
19-
tokio = "0.2"
19+
futures-timer = "3.0.2"

node/core/provisioner/src/lib.rs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -648,6 +648,7 @@ mod tests {
648648
}
649649

650650
mod select_candidates {
651+
use futures_timer::Delay;
651652
use super::super::*;
652653
use super::{build_occupied_core, default_bitvec, occupied_core, scheduled_core};
653654
use polkadot_node_subsystem::messages::RuntimeApiRequest::{
@@ -675,9 +676,7 @@ mod tests {
675676

676677
futures::pin_mut!(overseer, test);
677678

678-
tokio::runtime::Runtime::new()
679-
.unwrap()
680-
.block_on(future::select(overseer, test));
679+
futures::executor::block_on(future::select(overseer, test));
681680
}
682681

683682
// For test purposes, we always return this set of availability cores:
@@ -784,12 +783,12 @@ mod tests {
784783
// drop the receiver so it closes and the sender can't send, then just sleep long enough that
785784
// this is almost certainly not the first of the two futures to complete
786785
std::mem::drop(rx);
787-
tokio::time::delay_for(std::time::Duration::from_secs(1)).await;
786+
Delay::new(std::time::Duration::from_secs(1)).await;
788787
};
789788

790789
let test = |mut tx: mpsc::Sender<FromJob>| async move {
791790
// wait so that the overseer can drop the rx before we attempt to send
792-
tokio::time::delay_for(std::time::Duration::from_millis(50)).await;
791+
Delay::new(std::time::Duration::from_millis(50)).await;
793792
let result = select_candidates(&[], &[], &[], Default::default(), &mut tx).await;
794793
println!("{:?}", result);
795794
assert!(std::matches!(result, Err(Error::OneshotSend)));

0 commit comments

Comments
 (0)