From 9e9ca9c28071209302b1a99bb5bf0fcaf15ac509 Mon Sep 17 00:00:00 2001 From: benthecarman Date: Thu, 30 May 2024 13:55:38 -0500 Subject: [PATCH] Make 30 second db timeout for all tests --- src/db.rs | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/db.rs b/src/db.rs index 4fe4e29..030e058 100644 --- a/src/db.rs +++ b/src/db.rs @@ -21,12 +21,11 @@ pub const MIGRATIONS: EmbeddedMigrations = embed_migrations!(); pub(crate) fn setup_db(url: &str, password: String) -> anyhow::Result> { let manager = ConnectionManager::::new(url); - // CI is slow, make timeout longer - let timeout = if std::env::var("CI").is_ok() { - Duration::from_secs(30) - } else { - Duration::from_secs(5) - }; + // tests can be slow, make timeout longer + #[cfg(test)] + let timeout = Duration::from_secs(30); + #[cfg(not(test))] + let timeout = Duration::from_secs(5); let pool = Pool::builder() .max_size(50)