@Test
  public void testReportExpiration() throws Exception {
    Configuration conf = TEST_UTIL.getConfiguration();
    // Send reports every 25 seconds
    conf.setInt(RegionSizeReportingChore.REGION_SIZE_REPORTING_CHORE_PERIOD_KEY, 25000);
    // Expire the reports after 5 seconds
    conf.setInt(QuotaObserverChore.REGION_REPORT_RETENTION_DURATION_KEY, 5000);
    TEST_UTIL.startMiniCluster(1);
    // Wait till quota table onlined.
    TEST_UTIL.waitFor(10000, new Waiter.Predicate<Exception>() {
      @Override
      public boolean evaluate() throws Exception {
        return TEST_UTIL.getAdmin().tableExists(QuotaTableUtil.QUOTA_TABLE_NAME);
      }
    });

    final String FAM1 = "f1";
    final HMaster master = TEST_UTIL.getMiniHBaseCluster().getMaster();
    // Wait for the master to finish initialization.
    while (master.getMasterQuotaManager() == null) {
      LOG.debug("MasterQuotaManager is null, waiting...");
      Thread.sleep(500);
    }
    final MasterQuotaManager quotaManager = master.getMasterQuotaManager();

    // Create a table
    final TableName tn = TableName.valueOf("reportExpiration");
    TableDescriptor tableDesc = TableDescriptorBuilder.newBuilder(tn)
      .setColumnFamily(ColumnFamilyDescriptorBuilder.of(FAM1)).build();
    TEST_UTIL.getAdmin().createTable(tableDesc);

    // No reports right after we created this table.
    assertEquals(0, getRegionReportsForTable(quotaManager.snapshotRegionSizes(), tn));

    // Set a quota
    final long sizeLimit = 100L * SpaceQuotaHelperForTests.ONE_MEGABYTE;
    final SpaceViolationPolicy violationPolicy = SpaceViolationPolicy.NO_INSERTS;
    QuotaSettings settings = QuotaSettingsFactory.limitTableSpace(tn, sizeLimit, violationPolicy);
    TEST_UTIL.getAdmin().setQuota(settings);

    // We should get one report for the one region we have.
    Waiter.waitFor(TEST_UTIL.getConfiguration(), 45000, 1000, new Waiter.Predicate<Exception>() {
      @Override
      public boolean evaluate() throws Exception {
        int numReports = getRegionReportsForTable(quotaManager.snapshotRegionSizes(), tn);
        LOG.debug("Saw " + numReports + " reports for " + tn + " while waiting for 1");
        return numReports == 1;
      }
    });

    // We should then see no reports for the single region
    Waiter.waitFor(TEST_UTIL.getConfiguration(), 15000, 1000, new Waiter.Predicate<Exception>() {
      @Override
      public boolean evaluate() throws Exception {
        int numReports = getRegionReportsForTable(quotaManager.snapshotRegionSizes(), tn);
        LOG.debug("Saw " + numReports + " reports for " + tn + " while waiting for none");
        return numReports == 0;
      }
    });
  }
A test case to verify that region reports are expired when they are not sent.
hbase-server/src/test/java/org/apache/hadoop/hbase/quotas/TestQuotaObserverChoreRegionReports.java