From 29f0fde0bf04408dd3c35d5122bacda8289e6926 Mon Sep 17 00:00:00 2001 From: Wojtek Wajerowicz <115081248+wojciech-wajerowicz-sonarsource@users.noreply.github.com> Date: Tue, 23 Jan 2024 10:37:50 +0100 Subject: [PATCH] SONAR-20451 Extend reset time in RatioBasedRateLimitCheckerTest. --- .../org/sonar/alm/client/RatioBasedRateLimitCheckerTest.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/server/sonar-alm-client/src/test/java/org/sonar/alm/client/RatioBasedRateLimitCheckerTest.java b/server/sonar-alm-client/src/test/java/org/sonar/alm/client/RatioBasedRateLimitCheckerTest.java index 39a85ff31de..b7d1b2aee8d 100644 --- a/server/sonar-alm-client/src/test/java/org/sonar/alm/client/RatioBasedRateLimitCheckerTest.java +++ b/server/sonar-alm-client/src/test/java/org/sonar/alm/client/RatioBasedRateLimitCheckerTest.java @@ -40,6 +40,7 @@ public class RatioBasedRateLimitCheckerTest { @Rule public LogTester logTester = new LogTester(); private static final long MILLIS_BEFORE_RESET = 100L; + public static final int TIME_UNTIL_RESET = 2; RatioBasedRateLimitChecker ratioBasedRateLimitChecker = new RatioBasedRateLimitChecker(); @DataProvider @@ -62,7 +63,7 @@ public class RatioBasedRateLimitCheckerTest { ApplicationHttpClient.RateLimit record = mock(); when(record.limit()).thenReturn(limit); when(record.remaining()).thenReturn(remaining); - when(record.reset()).thenReturn(System.currentTimeMillis() / 1000 + 1); + when(record.reset()).thenReturn(System.currentTimeMillis() / 1000 + TIME_UNTIL_RESET); long start = System.currentTimeMillis(); boolean result = ratioBasedRateLimitChecker.checkRateLimit(record); -- 2.39.5