You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by zh...@apache.org on 2020/09/02 02:11:03 UTC

[hbase] branch branch-2 updated: HBASE-24964 addendum fix TestMetaTableMetrics (#2340)

This is an automated email from the ASF dual-hosted git repository.

zhangduo pushed a commit to branch branch-2
in repository https://gitbox.apache.org/repos/asf/hbase.git


The following commit(s) were added to refs/heads/branch-2 by this push:
     new 70c6205  HBASE-24964 addendum fix TestMetaTableMetrics (#2340)
70c6205 is described below

commit 70c6205bc2b537573d445db143be5e4d7de5813e
Author: Duo Zhang <zh...@apache.org>
AuthorDate: Wed Sep 2 10:10:36 2020 +0800

    HBASE-24964 addendum fix TestMetaTableMetrics (#2340)
    
    Signed-off-by: Viraj Jasani <vj...@apache.org>
---
 .../hadoop/hbase/coprocessor/TestMetaTableMetrics.java       | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/coprocessor/TestMetaTableMetrics.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/coprocessor/TestMetaTableMetrics.java
index 02a4bde..33f1599 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/coprocessor/TestMetaTableMetrics.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/coprocessor/TestMetaTableMetrics.java
@@ -19,6 +19,7 @@
 
 package org.apache.hadoop.hbase.coprocessor;
 
+import static org.junit.Assert.assertArrayEquals;
 import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.fail;
 
@@ -33,7 +34,6 @@ import java.util.List;
 import java.util.Map;
 import java.util.Random;
 import java.util.Set;
-
 import javax.management.MBeanAttributeInfo;
 import javax.management.MBeanInfo;
 import javax.management.MBeanServerConnection;
@@ -41,7 +41,6 @@ import javax.management.ObjectInstance;
 import javax.management.ObjectName;
 import javax.management.remote.JMXConnector;
 import javax.management.remote.JMXConnectorFactory;
-
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.hbase.HBaseClassTestRule;
 import org.apache.hadoop.hbase.HBaseTestingUtility;
@@ -141,7 +140,8 @@ public class TestMetaTableMetrics {
   public void testMetaTableMetricsInJmx() throws Exception {
     UTIL.getAdmin()
         .createTable(TableDescriptorBuilder.newBuilder(NAME1).setColumnFamily(CFD).build());
-    writeData(NAME1);
+    assertTrue(UTIL.getAdmin().isTableEnabled(NAME1));
+    readWriteData(NAME1);
     UTIL.deleteTable(NAME1);
 
     UTIL.waitFor(30000, 2000, true, () -> {
@@ -187,7 +187,7 @@ public class TestMetaTableMetrics {
     }
   }
 
-  private void writeData(TableName tableName) throws IOException {
+  private void readWriteData(TableName tableName) throws IOException {
     try (Table t = UTIL.getConnection().getTable(tableName)) {
       List<Put> puts = new ArrayList<>(NUM_ROWS);
       for (int i = 0; i < NUM_ROWS; i++) {
@@ -196,6 +196,10 @@ public class TestMetaTableMetrics {
         puts.add(p);
       }
       t.put(puts);
+      for (int i = 0; i < NUM_ROWS; i++) {
+        Get get = new Get(Bytes.toBytes(i + 1));
+        assertArrayEquals(Bytes.toBytes(value), t.get(get).getValue(FAMILY, QUALIFIER));
+      }
     }
   }