mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-30 03:31:05 +00:00
provisioner tests: remove tokio from dev-dependencies (#1745)
* provisioner: remove tokio from dev-dependencies * provisioner: use futures_timer instead
This commit is contained in:
Generated
+1
-1
@@ -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]]
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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)));
|
||||
|
||||
Reference in New Issue
Block a user