From 9203dd3ef7b62489116e7b7fe0b9d288c3389c78 Mon Sep 17 00:00:00 2001 From: Vika Date: Sun, 26 Sep 2021 02:04:27 +0300 Subject: Moved integration tests and allowed the binary to use file backend Now the Redis dependencies are optional and only required if you want to test the backend or actually use it in production. The app displays a hint if you try to launch with an unsupported backend. --- src/database/mod.rs | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/database/mod.rs') diff --git a/src/database/mod.rs b/src/database/mod.rs index e6873b0..a1f5861 100644 --- a/src/database/mod.rs +++ b/src/database/mod.rs @@ -3,10 +3,14 @@ use crate::indieauth::User; use async_trait::async_trait; use serde::{Deserialize, Serialize}; +#[cfg(redis)] mod redis; +#[cfg(redis)] pub use crate::database::redis::RedisStorage; +#[cfg(redis)] #[cfg(test)] pub use redis::tests::{get_redis_instance, RedisInstance}; + mod file; pub use crate::database::file::FileStorage; @@ -184,6 +188,7 @@ pub trait Storage: Clone + Send + Sync { #[cfg(test)] mod tests { + #[cfg(redis)] use super::redis::tests::get_redis_instance; use super::{MicropubChannel, Storage}; use serde_json::json; @@ -352,6 +357,7 @@ mod tests { macro_rules! redis_test { ($func_name:expr) => { paste! { + #[cfg(redis)] #[async_std::test] async fn [] () { test_logger::ensure_env_logger_initialized(); -- cgit 1.4.1