HBASE-13974 TestRateLimiter#testFixedIntervalResourceAvailability may fail (Guanghao Zhang)
This commit is contained in:
parent
33d74b4f68
commit
1650b228d0
|
@ -135,13 +135,13 @@ public class TestRateLimiter {
|
||||||
@Test
|
@Test
|
||||||
public void testFixedIntervalResourceAvailability() throws Exception {
|
public void testFixedIntervalResourceAvailability() throws Exception {
|
||||||
RateLimiter limiter = new FixedIntervalRateLimiter();
|
RateLimiter limiter = new FixedIntervalRateLimiter();
|
||||||
limiter.set(10, TimeUnit.MILLISECONDS);
|
limiter.set(10, TimeUnit.SECONDS);
|
||||||
|
|
||||||
assertTrue(limiter.canExecute(10));
|
assertTrue(limiter.canExecute(10));
|
||||||
limiter.consume(3);
|
limiter.consume(3);
|
||||||
assertEquals(7, limiter.getAvailable());
|
assertEquals(7, limiter.getAvailable());
|
||||||
assertFalse(limiter.canExecute(10));
|
assertFalse(limiter.canExecute(10));
|
||||||
limiter.setNextRefillTime(limiter.getNextRefillTime() - 3);
|
limiter.setNextRefillTime(limiter.getNextRefillTime() - 1000);
|
||||||
assertTrue(limiter.canExecute(10));
|
assertTrue(limiter.canExecute(10));
|
||||||
assertEquals(10, limiter.getAvailable());
|
assertEquals(10, limiter.getAvailable());
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue