Skip to content

Commit

Permalink
server: redis test refacor (please squash)
Browse files Browse the repository at this point in the history
  • Loading branch information
svix-jplatte committed Feb 28, 2024
1 parent cc332e2 commit 9e48ab3
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions server/svix-server/src/queue/redis.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down Expand Up @@ -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";
Expand Down Expand Up @@ -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(),
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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";
Expand Down

0 comments on commit 9e48ab3

Please sign in to comment.