From 9a25c3b2339cd857edcd531f0340a5da989a264e Mon Sep 17 00:00:00 2001 From: Alex Ted Date: Fri, 28 Feb 2025 12:17:26 +0300 Subject: [PATCH] fix(tests): ignore tests if postgres isn't up --- databases/diesel-async/Cargo.toml | 3 +++ databases/diesel-async/src/main.rs | 3 ++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/databases/diesel-async/Cargo.toml b/databases/diesel-async/Cargo.toml index fbd7827b..fbf35f2f 100644 --- a/databases/diesel-async/Cargo.toml +++ b/databases/diesel-async/Cargo.toml @@ -3,6 +3,9 @@ name = "db-diesel-async" version = "1.0.0" edition = "2021" +[features] +postgres_tests = [] + [dependencies] actix-web.workspace = true diesel = { version = "2", default-features = false, features = ["uuid"] } diff --git a/databases/diesel-async/src/main.rs b/databases/diesel-async/src/main.rs index b499a5cd..5d315c01 100644 --- a/databases/diesel-async/src/main.rs +++ b/databases/diesel-async/src/main.rs @@ -106,7 +106,8 @@ async fn initialize_db_pool() -> DbPool { Pool::builder().build(connection_manager).await.unwrap() } -#[cfg(test)] +#[cfg(not(feature = "postgres_tests"))] +#[allow(unused_imports)] mod tests { use actix_web::{http::StatusCode, test}; use diesel::prelude::*;