From 194cfae4817fd3c29f2dcbcfe473437e3c1293c3 Mon Sep 17 00:00:00 2001 From: Cristian Pufu Date: Thu, 16 Nov 2023 08:11:25 +0200 Subject: [PATCH] Fix tests cleanup --- .../RedisRateLimiting.Tests/UnitTests/ConcurrencyUnitTests.cs | 4 ++-- .../UnitTests/SlidingWindowUnitTests.cs | 2 +- test/RedisRateLimiting.Tests/UnitTests/TestFixture.cs | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/test/RedisRateLimiting.Tests/UnitTests/ConcurrencyUnitTests.cs b/test/RedisRateLimiting.Tests/UnitTests/ConcurrencyUnitTests.cs index fed46f9..71e246d 100644 --- a/test/RedisRateLimiting.Tests/UnitTests/ConcurrencyUnitTests.cs +++ b/test/RedisRateLimiting.Tests/UnitTests/ConcurrencyUnitTests.cs @@ -55,7 +55,7 @@ public async Task ThrowsWhenAcquiringMoreThanLimit() [Fact] public async Task CanAcquireAsyncResource() { - await Fixture.ClearStatisticsAsync("Test_CanAcquireAsyncResource"); + await Fixture.ClearStatisticsAsync("cc", "Test_CanAcquireAsyncResource"); using var limiter = new RedisConcurrencyRateLimiter( "Test_CanAcquireAsyncResource", @@ -169,7 +169,7 @@ public async Task FailsWhenQueuingMoreThanLimit() [Fact] public async Task QueueAvailableAfterQueueLimitHitAndResourcesBecomeAvailable() { - await Fixture.ClearStatisticsAsync("Test_QueueAvailableAfterQueueLimitHitAndResourcesBecomeAvailable"); + await Fixture.ClearStatisticsAsync("cc", "Test_QueueAvailableAfterQueueLimitHitAndResourcesBecomeAvailable"); using var limiter = new RedisConcurrencyRateLimiter( "Test_QueueAvailableAfterQueueLimitHitAndResourcesBecomeAvailable", diff --git a/test/RedisRateLimiting.Tests/UnitTests/SlidingWindowUnitTests.cs b/test/RedisRateLimiting.Tests/UnitTests/SlidingWindowUnitTests.cs index c1bf730..c07fa49 100644 --- a/test/RedisRateLimiting.Tests/UnitTests/SlidingWindowUnitTests.cs +++ b/test/RedisRateLimiting.Tests/UnitTests/SlidingWindowUnitTests.cs @@ -71,7 +71,7 @@ public async Task ThrowsWhenAcquiringMoreThanLimit() [Fact] public async Task CanAcquireAsyncResource() { - await Fixture.ClearStatisticsAsync("Test_CanAcquireAsyncResource_SW"); + await Fixture.ClearStatisticsAsync("sw", "Test_CanAcquireAsyncResource_SW"); using var limiter = new RedisSlidingWindowRateLimiter( "Test_CanAcquireAsyncResource_SW", diff --git a/test/RedisRateLimiting.Tests/UnitTests/TestFixture.cs b/test/RedisRateLimiting.Tests/UnitTests/TestFixture.cs index 7405526..e1ec18c 100644 --- a/test/RedisRateLimiting.Tests/UnitTests/TestFixture.cs +++ b/test/RedisRateLimiting.Tests/UnitTests/TestFixture.cs @@ -23,9 +23,9 @@ public TestFixture() ConnectionMultiplexerFactory = () => ConnectionMultiplexer; } - public async Task ClearStatisticsAsync(string partitionKey) + public async Task ClearStatisticsAsync(string rl, string partitionKey) { - var key = $"rl:{{{partitionKey}}}:stats"; + var key = $"rl:{rl}:{{{partitionKey}}}:stats"; var database = ConnectionMultiplexer.GetDatabase(); await database.KeyDeleteAsync(key); }