From 062cd0ff0176f1f9924e3ae89c0eaf01a8d6fd04 Mon Sep 17 00:00:00 2001 From: pennae Date: Thu, 14 Jul 2022 09:17:16 +0200 Subject: allow integration tests to run in parallel this doesn't do much for performance, but it does allow running the tests with a simple `cargo t`. --- src/bin/minorskulk.rs | 2 +- src/lib.rs | 9 ++++----- 2 files changed, 5 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/bin/minorskulk.rs b/src/bin/minorskulk.rs index 1609edb..21665a9 100644 --- a/src/bin/minorskulk.rs +++ b/src/bin/minorskulk.rs @@ -4,6 +4,6 @@ use minor_skulk::build; async fn main() -> anyhow::Result<()> { dotenv::dotenv().ok(); - let _ = build().await?.launch().await?; + let _ = build(rocket::build()).await?.launch().await?; Ok(()) } diff --git a/src/lib.rs b/src/lib.rs index 1e6fa31..75232ee 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -54,7 +54,7 @@ fn default_task_interval() -> std::time::Duration { std::time::Duration::from_secs(5 * 60) } -#[derive(serde::Deserialize)] +#[derive(Debug, serde::Deserialize)] struct Config { database_url: String, location: Absolute<'static>, @@ -203,9 +203,8 @@ async fn ensure_invite_admin(db: &Db, cfg: &Config) -> anyhow::Result<()> { } } -pub async fn build() -> anyhow::Result> { - let rocket = rocket::build(); - let config = rocket.figment().extract::().context("reading config")?; +pub async fn build(base: rocket::Rocket) -> anyhow::Result> { + let config = base.figment().extract::().context("reading config")?; let db = Arc::new(Db::connect(&config.database_url).await.unwrap()); db.migrate().await.context("running db migrations")?; @@ -245,7 +244,7 @@ pub async fn build() -> anyhow::Result> { Ok(()) } }); - let rocket = rocket + let rocket = base .manage(config) .manage(push) .manage(mailer) -- cgit v1.2.3