From 4cf846d08570256115ac8c2787d0f7fbf162be23 Mon Sep 17 00:00:00 2001 From: Josh Elser Date: Wed, 21 Feb 2018 17:17:57 -0500 Subject: [PATCH] HBASE-20035 Stabilize the flaky TestQuotaStatusRPCs The test will fail if the quota moves to violation before the second half of the test. Signed-off-by: Michael Stack --- .../hadoop/hbase/quotas/TestQuotaStatusRPCs.java | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/quotas/TestQuotaStatusRPCs.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/quotas/TestQuotaStatusRPCs.java index dffa6374666..3e14b8a6488 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/quotas/TestQuotaStatusRPCs.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/quotas/TestQuotaStatusRPCs.java @@ -199,8 +199,11 @@ public class TestQuotaStatusRPCs { @Test public void testQuotaStatusFromMaster() throws Exception { - final long sizeLimit = 1024L * 10L; // 10KB - final long tableSize = 1024L * 5; // 5KB + final long sizeLimit = 1024L * 25L; // 25KB + // As of 2.0.0-beta-2, this 1KB of "Cells" actually results in about 15KB on disk (HFiles) + // This is skewed a bit since we're writing such little data, so the test needs to keep + // this in mind; else, the quota will be in violation before the test expects it to be. + final long tableSize = 1024L * 1; // 1KB final long nsLimit = Long.MAX_VALUE; final int numRegions = 10; final TableName tn = helper.createTableWithRegions(numRegions); @@ -245,6 +248,12 @@ public class TestQuotaStatusRPCs { } }); + // Sanity check: the below assertions will fail if we somehow write too much data + // and force the table to move into violation before we write the second bit of data. + SpaceQuotaSnapshot snapshot = QuotaTableUtil.getCurrentSnapshot(conn, tn); + assertTrue("QuotaSnapshot for " + tn + " should be non-null and not in violation", + snapshot != null && !snapshot.getQuotaStatus().isInViolation()); + try { helper.writeData(tn, tableSize * 2L); } catch (RetriesExhaustedWithDetailsException | SpaceLimitingException e) {