File tree Expand file tree Collapse file tree 1 file changed +4
-3
lines changed
extended/src/test/java/io/kubernetes/client/extended/workqueue Expand file tree Collapse file tree 1 file changed +4
-3
lines changed Original file line number Diff line number Diff line change 17
17
import io .kubernetes .client .extended .workqueue .ratelimiter .RateLimiter ;
18
18
import java .time .Duration ;
19
19
import java .util .concurrent .Executors ;
20
- import java .util .concurrent .TimeUnit ;
21
20
import org .junit .Test ;
22
21
23
22
public class DefaultRateLimitQueueTest {
@@ -26,9 +25,11 @@ private static class MockRateLimiter<T> implements RateLimiter<T> {
26
25
27
26
private int count ;
28
27
28
+ private static Duration mockConstantBackoff = Duration .ofMillis (500 );
29
+
29
30
@ Override
30
31
public Duration when (Object item ) {
31
- return Duration . ofMillis ( 500 ) ;
32
+ return mockConstantBackoff ;
32
33
}
33
34
34
35
@ Override
@@ -53,6 +54,6 @@ public void testSimpleRateLimitQueue() throws Exception {
53
54
rlq .addRateLimited ("foo" );
54
55
rlq .get ();
55
56
long t2 = System .nanoTime ();
56
- assertTrue (t2 - t1 > TimeUnit . MILLISECONDS .toNanos (500 ));
57
+ assertTrue (t2 - t1 > MockRateLimiter . mockConstantBackoff .toNanos ());
57
58
}
58
59
}
You can’t perform that action at this time.
0 commit comments