diff --git a/src/tools/broadcast_future.rs b/src/tools/broadcast_future.rs index 9c238e4bb..796533395 100644 --- a/src/tools/broadcast_future.rs +++ b/src/tools/broadcast_future.rs @@ -159,16 +159,18 @@ fn test_broadcast_future() { .map_err(|err| { panic!("got errror {}", err); }) .map(|_| ()); - let rt = tokio::runtime::Runtime::new().unwrap(); + let receiver_finish = sender.listen(); + + let mut rt = tokio::runtime::Runtime::new().unwrap(); rt.block_on(async move { tokio::spawn(receiver1); tokio::spawn(receiver2); trigger.send(Ok(1)).unwrap(); + let _ = receiver_finish.await; }); - rt.shutdown_on_idle(); let result = CHECKSUM.load(Ordering::SeqCst); - assert!(result == 3); + assert_eq!(result, 3); } diff --git a/tests/worker-task-abort.rs b/tests/worker-task-abort.rs index 2e4246d31..64f27b3ec 100644 --- a/tests/worker-task-abort.rs +++ b/tests/worker-task-abort.rs @@ -39,7 +39,7 @@ fn worker_task_abort() -> Result<(), Error> { let errmsg: Arc>> = Arc::new(Mutex::new(None)); let errmsg1 = errmsg.clone(); - let rt = tokio::runtime::Runtime::new().unwrap(); + let mut rt = tokio::runtime::Runtime::new().unwrap(); rt.block_on(async move { let init_result: Result<(), Error> = try_block!({ @@ -80,7 +80,6 @@ fn worker_task_abort() -> Result<(), Error> { } } }); - rt.shutdown_on_idle(); let data = errmsg.lock().unwrap(); match *data {