#[cfg(unix)]
#[cfg(test)]
mod unix_tests {
use std::time::Duration;
use super::super::install_shutdown_handler;
#[tokio::test]
async fn sigterm_trips_shutdown_token() {
let signals = install_shutdown_handler().expect("install handler");
let token = signals.token();
let me = std::process::id();
unsafe {
libc::kill(me as libc::pid_t, libc::SIGTERM);
}
let waited = tokio::time::timeout(Duration::from_secs(2), token.cancelled()).await;
assert!(waited.is_ok(), "shutdown token did not trip within 2s");
}
}