From da52d398b654bf90db9e077f342c7cb0fb19f7ae Mon Sep 17 00:00:00 2001 From: Max Kalashnikoff Date: Thu, 20 Jun 2024 17:56:30 +0200 Subject: [PATCH] fix(clippy): fixing updated clippy dead code warnings --- tests/context/mod.rs | 32 ++++++++++++++++++++++------- tests/functional/multitenant/mod.rs | 1 + 2 files changed, 26 insertions(+), 7 deletions(-) diff --git a/tests/context/mod.rs b/tests/context/mod.rs index 9cad39e6..a08ce771 100644 --- a/tests/context/mod.rs +++ b/tests/context/mod.rs @@ -1,10 +1,9 @@ +#[cfg(feature = "functional_tests")] +use echo_server::state::{ClientStoreArc, NotificationStoreArc, TenantStoreArc}; use { self::server::EchoServer, async_trait::async_trait, - echo_server::{ - config::Config, - state::{ClientStoreArc, NotificationStoreArc, TenantStoreArc}, - }, + echo_server::config::Config, sqlx::{Pool, Postgres}, std::{env, sync::Arc}, test_context::{AsyncTestContext, TestContext}, @@ -19,6 +18,12 @@ pub struct ConfigContext { pub struct EchoServerContext { pub server: EchoServer, + #[cfg(all( + feature = "multitenant", + feature = "apns_tests", + feature = "fcm_tests", + feature = "fcmv1_tests" + ))] pub config: Config, } @@ -26,8 +31,11 @@ pub struct StoreContext { pub pool: Arc>, pub tenant_pool: Arc>, + #[cfg(feature = "functional_tests")] pub clients: ClientStoreArc, + #[cfg(feature = "functional_tests")] pub notifications: NotificationStoreArc, + #[cfg(feature = "functional_tests")] pub tenants: TenantStoreArc, } @@ -92,9 +100,16 @@ impl TestContext for ConfigContext { #[async_trait] impl AsyncTestContext for EchoServerContext { async fn setup() -> Self { - let config = ConfigContext::setup().config; - let server = EchoServer::start(ConfigContext::setup().config).await; - Self { server, config } + Self { + server: EchoServer::start(ConfigContext::setup().config).await, + #[cfg(all( + feature = "multitenant", + feature = "apns_tests", + feature = "fcm_tests", + feature = "fcmv1_tests" + ))] + config: ConfigContext::setup().config, + } } async fn teardown(mut self) { @@ -115,8 +130,11 @@ impl AsyncTestContext for StoreContext { Self { pool: db_arc.clone(), tenant_pool: tenant_db_arc.clone(), + #[cfg(feature = "functional_tests")] clients: db_arc.clone(), + #[cfg(feature = "functional_tests")] notifications: db_arc.clone(), + #[cfg(feature = "functional_tests")] tenants: tenant_db_arc.clone(), } } diff --git a/tests/functional/multitenant/mod.rs b/tests/functional/multitenant/mod.rs index aec2ffa6..b22a9c45 100644 --- a/tests/functional/multitenant/mod.rs +++ b/tests/functional/multitenant/mod.rs @@ -13,6 +13,7 @@ mod apns; mod fcm; #[cfg(feature = "fcmv1_tests")] mod fcm_v1; +#[cfg(feature = "multitenant")] mod tenancy; /// Struct to hold claims for JWT validation