Skip to content

Commit

Permalink
runtime: test for shutdown_timeout(0) (#3196)
Browse files Browse the repository at this point in the history
  • Loading branch information
kykosic committed Nov 29, 2020
1 parent c55d846 commit a85fdb8
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions tokio/tests/rt_common.rs
Expand Up @@ -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();
Expand Down

0 comments on commit a85fdb8

Please sign in to comment.