runtime: test for shutdown_timeout(0) (#3196)

This commit is contained in:
Kyle Kosic 2020-11-29 15:30:19 -05:00 committed by GitHub
parent c55d846f4b
commit a85fdb884d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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();