Rocket/core/lib/tests/timer-on-attach.rs
Sergio Benitez ad36b769bc Rename 'rocket::ignite()' to 'rocket::build()'.
...because loading up a Rocket while it's ignited is a bad idea.

More seriously, because 'Rocket.ignite()' will become an "execute
everything up to here" method.
2021-04-08 01:07:52 -07:00

16 lines
503 B
Rust

#[rocket::async_test]
async fn test_await_timer_inside_attach() {
async fn do_async_setup() {
// By using a timer or I/O resource, we ensure that do_async_setup will
// deadlock if no thread is able to tick the time or I/O drivers.
rocket::tokio::time::sleep(std::time::Duration::from_millis(100)).await;
}
rocket::build()
.attach(rocket::fairing::AdHoc::on_launch("1", |rocket| async {
do_async_setup().await;
rocket
}));
}