summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKyle Kosic <kylekosic@gmail.com>2020-11-29 15:30:19 -0500
committerGitHub <noreply@github.com>2020-11-29 21:30:19 +0100
commita85fdb884d961bb87a2f3d446c548802868e54cb (patch)
treec554597c6596dc6eddc98bfafcc512361ddb5f31
parentc55d846f4b248b4a72335d6c57829fa6396ab9a5 (diff)
runtime: test for shutdown_timeout(0) (#3196)
-rw-r--r--tokio/tests/rt_common.rs15
1 files changed, 15 insertions, 0 deletions
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
@@ -858,6 +858,21 @@ rt_test! {
}
#[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();