diff --git a/core/lib/tests/on_launch_fairing_can_inspect_port.rs b/core/lib/tests/on_launch_fairing_can_inspect_port.rs index 52e8c78b..7ec0c61a 100644 --- a/core/lib/tests/on_launch_fairing_can_inspect_port.rs +++ b/core/lib/tests/on_launch_fairing_can_inspect_port.rs @@ -1,23 +1,15 @@ -#[macro_use] -extern crate rocket; - use rocket::config::Config; use rocket::fairing::AdHoc; -use rocket::figment::Figment; use rocket::futures::channel::oneshot; #[rocket::async_test] async fn on_launch_fairing_can_inspect_port() { let (tx, rx) = oneshot::channel(); - let mut config = Config::default(); - config.port = 0; - tokio::spawn( - rocket::custom(Figment::from(config)) - .mount("/", routes![]) - .attach(AdHoc::on_launch("Get assigned port", move |rocket| { - tx.send(rocket.config().port).unwrap(); - })) - .launch(), - ); - assert!(rx.await.unwrap() != 0); + let rocket = rocket::custom(Config { port: 0, ..Default::default() }) + .attach(AdHoc::on_launch("Send Port -> Channel", move |rocket| { + tx.send(rocket.config().port).unwrap(); + })); + + rocket::tokio::spawn(rocket.launch()); + assert_ne!(rx.await.unwrap(), 0); }