Uploaded image for project: 'HBase'
  1. HBase
  2. HBASE-13974

TestRateLimiter#testFixedIntervalResourceAvailability may fail

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 2.0.0
    • 1.2.0, 1.1.2, 1.3.0, 2.0.0
    • test
    • None
    • Reviewed

    Description

      Stacktrace

      java.lang.AssertionError: null
      at org.junit.Assert.fail(Assert.java:86)
      at org.junit.Assert.assertTrue(Assert.java:41)
      at org.junit.Assert.assertFalse(Assert.java:64)
      at org.junit.Assert.assertFalse(Assert.java:74)
      at org.apache.hadoop.hbase.quotas.TestRateLimiter.testFixedIntervalResourceAvailability(TestRateLimiter.java:151)

      The code of this ut.

           RateLimiter limiter = new FixedIntervalRateLimiter();
           limiter.set(10, TimeUnit.MILLISECONDS);
       
           assertTrue(limiter.canExecute(10));
           limiter.consume(3);
           assertEquals(7, limiter.getAvailable());
           assertFalse(limiter.canExecute(10));
      

      The limiter will refill by MILLISECONDS. So if this unit test execute slowly or hang by others over 1 ms, the assertFalse(limiter.canExecute(10)) will fail.

      Attachments

        1. HBASE-13974.patch
          1 kB
          Guanghao Zhang

        Activity

          People

            zghao Guanghao Zhang
            zghao Guanghao Zhang
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: