Repository: hbase
Updated Branches:
  refs/heads/branch-2 0432d49d8 -> 9d3eadd92
  refs/heads/master 2440f807b -> 4cf846d08


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 <st...@apache.org>


Project: http://git-wip-us.apache.org/repos/asf/hbase/repo
Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/9d3eadd9
Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/9d3eadd9
Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/9d3eadd9

Branch: refs/heads/branch-2
Commit: 9d3eadd924043a825f1a7efd48f5aefd3117ee5c
Parents: 0432d49
Author: Josh Elser <els...@apache.org>
Authored: Wed Feb 21 17:17:57 2018 -0500
Committer: Josh Elser <els...@apache.org>
Committed: Thu Feb 22 09:34:05 2018 -0500

----------------------------------------------------------------------
 .../hadoop/hbase/quotas/TestQuotaStatusRPCs.java       | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hbase/blob/9d3eadd9/hbase-server/src/test/java/org/apache/hadoop/hbase/quotas/TestQuotaStatusRPCs.java
----------------------------------------------------------------------
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 dffa637..3e14b8a 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) {

Reply via email to