From 9e48ab3e613fd834466354cbfeb192f5c8be8609 Mon Sep 17 00:00:00 2001 From: Jonas Platte Date: Wed, 28 Feb 2024 14:22:32 +0100 Subject: [PATCH] server: redis test refacor (please squash) --- server/svix-server/src/queue/redis.rs | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/server/svix-server/src/queue/redis.rs b/server/svix-server/src/queue/redis.rs index 57c0f7525..24114e208 100644 --- a/server/svix-server/src/queue/redis.rs +++ b/server/svix-server/src/queue/redis.rs @@ -700,23 +700,23 @@ pub mod tests { redis::RedisPool, }; - pub async fn get_pool(cfg: Configuration) -> RedisPool { + pub async fn get_pool(cfg: &Configuration) -> RedisPool { match cfg.cache_type { CacheType::RedisCluster => { crate::redis::new_redis_pool_clustered( cfg.redis_dsn.as_ref().unwrap().as_str(), - &cfg, + cfg, ) .await } - _ => crate::redis::new_redis_pool(cfg.redis_dsn.as_ref().unwrap().as_str(), &cfg).await, + _ => crate::redis::new_redis_pool(cfg.redis_dsn.as_ref().unwrap().as_str(), cfg).await, } } #[tokio::test] async fn test_migrate_list() { let cfg = crate::cfg::load().unwrap(); - let pool = get_pool(cfg).await; + let pool = get_pool(&cfg).await; let mut pool = pool.get().await.unwrap(); const TEST_QUEUE: &str = "{queue}_svix_test_queue_list"; @@ -748,7 +748,7 @@ pub mod tests { #[tokio::test] async fn test_migrate_sset() { let cfg = crate::cfg::load().unwrap(); - let pool = get_pool(cfg).await; + let pool = get_pool(&cfg).await; let mut pool = pool.get().await.unwrap(); const TEST_QUEUE: &str = "{queue}_svix_test_queue_sset"; @@ -797,7 +797,7 @@ pub mod tests { #[tokio::test] async fn test_idle_period() { let cfg = crate::cfg::load().unwrap(); - let pool = get_pool(cfg).await; + let pool = get_pool(&cfg).await; let (p, mut c) = new_pair_inner( pool.clone(), @@ -862,7 +862,7 @@ pub mod tests { #[tokio::test] async fn test_ack() { let cfg = crate::cfg::load().unwrap(); - let pool = get_pool(cfg).await; + let pool = get_pool(&cfg).await; // Delete the keys used in this test to ensure nothing pollutes the output let mut conn = pool @@ -921,7 +921,7 @@ pub mod tests { #[tokio::test] async fn test_nack() { let cfg = crate::cfg::load().unwrap(); - let pool = get_pool(cfg).await; + let pool = get_pool(&cfg).await; let (p, mut c) = new_pair_inner( pool, @@ -964,7 +964,7 @@ pub mod tests { #[tokio::test] async fn test_delay() { let cfg = crate::cfg::load().unwrap(); - let pool = get_pool(cfg).await; + let pool = get_pool(&cfg).await; let (p, mut c) = new_pair_inner( pool, @@ -1012,7 +1012,7 @@ pub mod tests { #[tokio::test] async fn test_migrations() { let cfg = crate::cfg::load().unwrap(); - let pool = get_pool(cfg).await; + let pool = get_pool(&cfg).await; // Test queue name constants let v1_main = "{test}_migrations_main_v1";