File tree 2 files changed +11
-8
lines changed
2 files changed +11
-8
lines changed Original file line number Diff line number Diff line change @@ -29,7 +29,7 @@ pub use tokio_postgres::Config as PostgresConfig;
29
29
// Re-export the Postgres PoolError for easier usages
30
30
pub use deadpool_postgres:: PoolError ;
31
31
// Re-export the redis RedisError for easier usage
32
- pub use redis:: { RedisError , cmd as redis_cmd } ;
32
+ pub use redis:: RedisError ;
33
33
34
34
pub type DbPool = deadpool_postgres:: Pool ;
35
35
@@ -138,7 +138,7 @@ pub async fn setup_migrations(environment: Environment) {
138
138
. expect ( "Reloading config for migration failed" ) ;
139
139
}
140
140
141
- #[ cfg( any ( test , feature = "test-util" ) ) ]
141
+ #[ cfg( feature = "test-util" ) ]
142
142
pub mod tests_postgres {
143
143
use std:: {
144
144
ops:: { Deref , DerefMut } ,
@@ -428,7 +428,7 @@ pub mod tests_postgres {
428
428
}
429
429
}
430
430
431
- #[ cfg( test) ]
431
+ #[ cfg( feature = " test-util" ) ]
432
432
pub mod redis_pool {
433
433
434
434
use dashmap:: DashMap ;
@@ -442,6 +442,9 @@ pub mod redis_pool {
442
442
443
443
use super :: * ;
444
444
445
+ /// Re-export [`redis::cmd`] for testing purposes
446
+ pub use redis:: cmd;
447
+
445
448
pub type Pool = deadpool:: managed:: Pool < Manager > ;
446
449
447
450
pub static TESTS_POOL : Lazy < Pool > =
Original file line number Diff line number Diff line change @@ -696,8 +696,8 @@ pub mod run {
696
696
use sentry:: {
697
697
application:: { logger, run} ,
698
698
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 ,
701
701
} ,
702
702
Application ,
703
703
} ;
@@ -729,9 +729,9 @@ pub mod run {
729
729
730
730
let postgres = postgres_connection ( 42 , postgres_config) . await ;
731
731
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
+
735
735
let campaign_remaining = CampaignRemaining :: new ( redis. clone ( ) ) ;
736
736
737
737
setup_test_migrations ( postgres. clone ( ) )
You can’t perform that action at this time.
0 commit comments