hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From li...@apache.org
Subject svn commit: r1590089 - /hbase/branches/0.89-fb/src/test/java/org/apache/hadoop/hbase/regionserver/TestRegionServerMetrics.java
Date Fri, 25 Apr 2014 18:18:32 GMT
Author: liyin
Date: Fri Apr 25 18:18:31 2014
New Revision: 1590089

URL: http://svn.apache.org/r1590089
Log:
[Master] Fix TestRegionServerMetrics

Author: adela

Summary:
disable & drop table after unit.
testMultipleRegions is relying on number of regions - which means if that unit is not executed
first number of regions will increase and test will fail.
Dropping table created in each unit to clear that out

Test Plan:
reshuffle test order execution

  @Test
  public void test() throws Exception {
    testGetNextSize();
    testCompactionWriteMetric();
    testMultipleRegions();
    testEncodingInCache();
  }

Reviewers: manukranthk, daviddeng, elliott

Reviewed By: manukranthk

CC: hbase-eng@

Differential Revision: https://phabricator.fb.com/D1294255

Modified:
    hbase/branches/0.89-fb/src/test/java/org/apache/hadoop/hbase/regionserver/TestRegionServerMetrics.java

Modified: hbase/branches/0.89-fb/src/test/java/org/apache/hadoop/hbase/regionserver/TestRegionServerMetrics.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.89-fb/src/test/java/org/apache/hadoop/hbase/regionserver/TestRegionServerMetrics.java?rev=1590089&r1=1590088&r2=1590089&view=diff
==============================================================================
--- hbase/branches/0.89-fb/src/test/java/org/apache/hadoop/hbase/regionserver/TestRegionServerMetrics.java
(original)
+++ hbase/branches/0.89-fb/src/test/java/org/apache/hadoop/hbase/regionserver/TestRegionServerMetrics.java
Fri Apr 25 18:18:31 2014
@@ -33,6 +33,7 @@ import org.apache.hadoop.hbase.HColumnDe
 import org.apache.hadoop.hbase.HConstants;
 import org.apache.hadoop.hbase.HTestConst;
 import org.apache.hadoop.hbase.KeyValue;
+import org.apache.hadoop.hbase.MasterNotRunningException;
 import org.apache.hadoop.hbase.client.Delete;
 import org.apache.hadoop.hbase.client.Get;
 import org.apache.hadoop.hbase.client.HBaseAdmin;
@@ -95,6 +96,13 @@ public class TestRegionServerMetrics {
     SchemaMetrics.validateMetricChanges(STARTING_METRICS);
   }
 
+  public static void disableAndDropTable(String tablename)
+      throws IOException {
+    HBaseAdmin admin = new HBaseAdmin(TEST_UTIL.getConfiguration());
+    admin.disableTable(tablename);
+    admin.deleteTable(tablename);
+  }
+
   private void assertStoreMetricEquals(long expected,
       SchemaMetrics schemaMetrics, StoreMetricType storeMetricType) {
     final String storeMetricName =
@@ -151,6 +159,8 @@ public class TestRegionServerMetrics {
         .getStoreMetricNameMax(StoreMetricType.STORE_FILE_COUNT);
     assertEquals("Invalid value for store metric " + storeMetricName,
         NUM_FLUSHES, HRegion.getNumericMetric(storeMetricName));
+
+    disableAndDropTable(TABLE_NAME);
   }
 
 
@@ -229,6 +239,8 @@ public class TestRegionServerMetrics {
     }
     assertSizeMetric(tableName, cfs,
         new int[] {kvLength, kvLength, kvLength, kvLength});
+
+    disableAndDropTable(tableName);
   }
 
   @Test
@@ -289,6 +301,8 @@ public class TestRegionServerMetrics {
       }
       TEST_UTIL.dropDefaultTable();
     }
+
+    disableAndDropTable(Bytes.toString(tableName));
   }
   
   @Test
@@ -348,5 +362,7 @@ public class TestRegionServerMetrics {
       HRegion.getNumericPersistentMetric(storeMetricFullName);
     Assert.assertTrue(compactionWriteSizeAfterCompactionAfterDelete 
                     == compactionWriteSizeAfterCompaction);
+
+    disableAndDropTable(tableName);
   }
 }



Mime
View raw message