diff options
author | Vika <vika@fireburn.ru> | 2021-09-26 02:04:27 +0300 |
---|---|---|
committer | Vika <vika@fireburn.ru> | 2021-09-26 02:06:56 +0300 |
commit | 9203dd3ef7b62489116e7b7fe0b9d288c3389c78 (patch) | |
tree | c958b9bd42241b4452262ddfe197b1e91d211cbb /src/database | |
parent | 572435f7c8e1d613983309eca268c3f87ec5f00f (diff) | |
download | kittybox-9203dd3ef7b62489116e7b7fe0b9d288c3389c78.tar.zst |
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.
Diffstat (limited to 'src/database')
-rw-r--r-- | src/database/mod.rs | 6 |
1 files changed, 6 insertions, 0 deletions
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 [<redis_ $func_name>] () { test_logger::ensure_env_logger_initialized(); |