From 0a71625c492b6429293e7671bfbbec5ab63c7e02 Mon Sep 17 00:00:00 2001 From: Kyle Kosic Date: Sun, 29 Nov 2020 11:34:01 -0500 Subject: [PATCH] add test for regression with shutdown_timeout 0 --- 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 74a94d5b9d1..d8f57bac94a 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();