Skip to content

Commit 3a099a4

Browse files
committed
sentry - db - re-export redis::cmd in redis_pool
1 parent 083cfba commit 3a099a4

File tree

2 files changed

+11
-8
lines changed

2 files changed

+11
-8
lines changed

sentry/src/db.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ pub use tokio_postgres::Config as PostgresConfig;
2929
// Re-export the Postgres PoolError for easier usages
3030
pub use deadpool_postgres::PoolError;
3131
// Re-export the redis RedisError for easier usage
32-
pub use redis::{RedisError, cmd as redis_cmd};
32+
pub use redis::RedisError;
3333

3434
pub type DbPool = deadpool_postgres::Pool;
3535

@@ -138,7 +138,7 @@ pub async fn setup_migrations(environment: Environment) {
138138
.expect("Reloading config for migration failed");
139139
}
140140

141-
#[cfg(any(test, feature = "test-util"))]
141+
#[cfg(feature = "test-util")]
142142
pub mod tests_postgres {
143143
use std::{
144144
ops::{Deref, DerefMut},
@@ -428,7 +428,7 @@ pub mod tests_postgres {
428428
}
429429
}
430430

431-
#[cfg(test)]
431+
#[cfg(feature = "test-util")]
432432
pub mod redis_pool {
433433

434434
use dashmap::DashMap;
@@ -442,6 +442,9 @@ pub mod redis_pool {
442442

443443
use super::*;
444444

445+
/// Re-export [`redis::cmd`] for testing purposes
446+
pub use redis::cmd;
447+
445448
pub type Pool = deadpool::managed::Pool<Manager>;
446449

447450
pub static TESTS_POOL: Lazy<Pool> =

test_harness/src/lib.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -696,8 +696,8 @@ pub mod run {
696696
use sentry::{
697697
application::{logger, run},
698698
db::{
699-
postgres_connection, redis_connection, tests_postgres::setup_test_migrations,
700-
CampaignRemaining,
699+
postgres_connection, redis_connection, redis_pool::Manager,
700+
tests_postgres::setup_test_migrations, CampaignRemaining,
701701
},
702702
Application,
703703
};
@@ -729,9 +729,9 @@ pub mod run {
729729

730730
let postgres = postgres_connection(42, postgres_config).await;
731731
let mut redis = redis_connection(app_config.redis_url).await?;
732-
sentry::db::redis_cmd("FLUSHDB")
733-
.query_async::<_, String>(&mut redis)
734-
.await.unwrap();
732+
733+
Manager::flush_db(&mut redis).expect("Should flush redis database");
734+
735735
let campaign_remaining = CampaignRemaining::new(redis.clone());
736736

737737
setup_test_migrations(postgres.clone())

0 commit comments

Comments
 (0)