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 1717import io .kubernetes .client .extended .workqueue .ratelimiter .RateLimiter ;
1818import java .time .Duration ;
1919import java .util .concurrent .Executors ;
20- import java .util .concurrent .TimeUnit ;
2120import org .junit .Test ;
2221
2322public class DefaultRateLimitQueueTest {
@@ -26,9 +25,11 @@ private static class MockRateLimiter<T> implements RateLimiter<T> {
2625
2726 private int count ;
2827
28+ private static Duration mockConstantBackoff = Duration .ofMillis (500 );
29+
2930 @ Override
3031 public Duration when (Object item ) {
31- return Duration . ofMillis ( 500 ) ;
32+ return mockConstantBackoff ;
3233 }
3334
3435 @ Override
@@ -53,6 +54,6 @@ public void testSimpleRateLimitQueue() throws Exception {
5354 rlq .addRateLimited ("foo" );
5455 rlq .get ();
5556 long t2 = System .nanoTime ();
56- assertTrue (t2 - t1 > TimeUnit . MILLISECONDS .toNanos (500 ));
57+ assertTrue (t2 - t1 > MockRateLimiter . mockConstantBackoff .toNanos ());
5758 }
5859}
You can’t perform that action at this time.
0 commit comments