From a85fdb884d961bb87a2f3d446c548802868e54cb Mon Sep 17 00:00:00 2001 From: Kyle Kosic Date: Sun, 29 Nov 2020 15:30:19 -0500 Subject: runtime: test for shutdown_timeout(0) (#3196) --- tokio/tests/rt_common.rs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/tokio/tests/rt_common.rs b/tokio/tests/rt_common.rs index 74a94d5b..d8f57bac 100644 --- a/tokio/tests/rt_common.rs +++ b/tokio/tests/rt_common.rs @@ -857,6 +857,21 @@ rt_test! { Arc::try_unwrap(runtime).unwrap().shutdown_timeout(Duration::from_millis(100)); } + #[test] + fn shutdown_timeout_0() { + let runtime = rt(); + + runtime.block_on(async move { + task::spawn_blocking(move || { + thread::sleep(Duration::from_secs(10_000)); + }); + }); + + let now = Instant::now(); + Arc::try_unwrap(runtime).unwrap().shutdown_timeout(Duration::from_nanos(0)); + assert!(now.elapsed().as_secs() < 1); + } + #[test] fn shutdown_wakeup_time() { let runtime = rt(); -- cgit v1.2.3