From 4e8b68dd14691ecc307b5074fe12225e47a3b637 Mon Sep 17 00:00:00 2001 From: Pierre Krieger Date: Tue, 19 Nov 2019 18:59:53 +0100 Subject: [PATCH] Fix the status-sinks tests, hopefully (#4140) --- substrate/client/service/src/status_sinks.rs | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/substrate/client/service/src/status_sinks.rs b/substrate/client/service/src/status_sinks.rs index 079ecf6353..8b8f859aa7 100644 --- a/substrate/client/service/src/status_sinks.rs +++ b/substrate/client/service/src/status_sinks.rs @@ -113,14 +113,14 @@ mod tests { use std::time::Duration; #[test] - fn basic_usage() { + fn works() { + // We're not testing that the `StatusSink` properly enforces an order in the intervals, as + // this easily causes test failures on busy CPUs. + let mut status_sinks = StatusSinks::new(); - let (tx1, rx1) = mpsc::unbounded(); - status_sinks.push(Duration::from_millis(200), tx1); - - let (tx2, rx2) = mpsc::unbounded(); - status_sinks.push(Duration::from_millis(500), tx2); + let (tx, rx) = mpsc::unbounded(); + status_sinks.push(Duration::from_millis(100), tx); let mut runtime = tokio::runtime::Runtime::new().unwrap(); @@ -130,15 +130,15 @@ mod tests { Ok(Async::NotReady) })); - let done = rx1 + let done = rx .into_future() .and_then(|(item, rest)| { assert_eq!(item, Some(6)); rest.into_future() }) - .and_then(|(item, _)| { + .and_then(|(item, rest)| { assert_eq!(item, Some(7)); - rx2.into_future() + rest.into_future() }) .map(|(item, _)| { assert_eq!(item, Some(8));