Skip to content

Commit

Permalink
Fix integration test
Browse files Browse the repository at this point in the history
  • Loading branch information
alexsnaps committed Mar 14, 2024
1 parent 0681e4f commit 8761a42
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion limitador-server/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ impl Limiter {
};

let mut rate_limiter_builder =
AsyncRateLimiterBuilder::new(AsyncStorage::with_counter_storage(Box::new(storage)));
AsyncRateLimiterBuilder::new(AsyncStorage::with_counter_storage(Arc::new(storage)));

if limit_name_labels {
rate_limiter_builder = rate_limiter_builder.with_prometheus_limit_name_labels()
Expand Down
5 changes: 3 additions & 2 deletions limitador/tests/integration_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ macro_rules! test_with_all_storage_impls {
let storage = AsyncRedisStorage::new("redis://127.0.0.1:6379").await.expect("We need a Redis running locally");
storage.clear().await.unwrap();
let rate_limiter = AsyncRateLimiter::new_with_storage(
Box::new(storage)
Arc::new(storage)
);
AsyncRedisStorage::new("redis://127.0.0.1:6379").await.expect("We need a Redis running locally").clear().await.unwrap();
$function(&mut TestsLimiter::new_from_async_impl(rate_limiter)).await;
Expand All @@ -64,7 +64,7 @@ macro_rules! test_with_all_storage_impls {
).build().await;
storage.clear().await.unwrap();
let rate_limiter = AsyncRateLimiter::new_with_storage(
Box::new(storage)
Arc::new(storage)
);
$function(&mut TestsLimiter::new_from_async_impl(rate_limiter)).await;
}
Expand All @@ -81,6 +81,7 @@ mod test {
// To be able to pass the tests without Redis
cfg_if::cfg_if! {
if #[cfg(feature = "redis_storage")] {
use std::sync::Arc;
use limitador::storage::redis::AsyncRedisStorage;
use limitador::storage::redis::RedisStorage;

Expand Down

0 comments on commit 8761a42

Please sign in to comment.