You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by sy...@apache.org on 2015/10/28 00:29:01 UTC

[02/17] hbase git commit: HBASE-14698 Set category timeouts on TestScanner and TestNamespaceAuditor

HBASE-14698 Set category timeouts on TestScanner and TestNamespaceAuditor


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

Branch: refs/heads/hbase-12439
Commit: 0f6ec611e653eec03cd3d2c516cbfcb202090916
Parents: 4c04e80
Author: stack <st...@apache.org>
Authored: Mon Oct 26 12:55:36 2015 -0700
Committer: stack <st...@apache.org>
Committed: Mon Oct 26 13:05:58 2015 -0700

----------------------------------------------------------------------
 .../hbase/io/encoding/TestDataBlockEncoders.java |  3 ---
 .../hbase/namespace/TestNamespaceAuditor.java    | 19 ++++++++++++-------
 .../hadoop/hbase/regionserver/TestScanner.java   |  5 +++++
 3 files changed, 17 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hbase/blob/0f6ec611/hbase-server/src/test/java/org/apache/hadoop/hbase/io/encoding/TestDataBlockEncoders.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/io/encoding/TestDataBlockEncoders.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/io/encoding/TestDataBlockEncoders.java
index 2e9e973..9863fac 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/io/encoding/TestDataBlockEncoders.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/io/encoding/TestDataBlockEncoders.java
@@ -32,9 +32,6 @@ import java.util.List;
 import java.util.Random;
 
 import org.apache.hadoop.hbase.CategoryBasedTimeout;
-import org.apache.hadoop.hbase.Cell;
-import org.apache.hadoop.hbase.CellComparator;
-import org.apache.hadoop.hbase.CellUtil;
 import org.apache.hadoop.hbase.HBaseTestingUtility;
 import org.apache.hadoop.hbase.HConstants;
 import org.apache.hadoop.hbase.KeyValue;

http://git-wip-us.apache.org/repos/asf/hbase/blob/0f6ec611/hbase-server/src/test/java/org/apache/hadoop/hbase/namespace/TestNamespaceAuditor.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/namespace/TestNamespaceAuditor.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/namespace/TestNamespaceAuditor.java
index 9912808..41a9713 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/namespace/TestNamespaceAuditor.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/namespace/TestNamespaceAuditor.java
@@ -37,6 +37,7 @@ import org.apache.commons.logging.LogFactory;
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.fs.FileSystem;
 import org.apache.hadoop.fs.Path;
+import org.apache.hadoop.hbase.CategoryBasedTimeout;
 import org.apache.hadoop.hbase.Coprocessor;
 import org.apache.hadoop.hbase.CoprocessorEnvironment;
 import org.apache.hadoop.hbase.DoNotRetryIOException;
@@ -85,13 +86,17 @@ import org.junit.After;
 import org.junit.AfterClass;
 import org.junit.BeforeClass;
 import org.junit.Ignore;
+import org.junit.Rule;
 import org.junit.Test;
 import org.junit.experimental.categories.Category;
+import org.junit.rules.TestRule;
 
 import com.google.common.collect.Sets;
 
 @Category(MediumTests.class)
 public class TestNamespaceAuditor {
+  @Rule public final TestRule timeout = CategoryBasedTimeout.builder().
+      withTimeout(this.getClass()).withLookingForStuckThread(true).build();
   private static final Log LOG = LogFactory.getLog(TestNamespaceAuditor.class);
   private static final HBaseTestingUtility UTIL = new HBaseTestingUtility();
   private static HBaseAdmin ADMIN;
@@ -133,7 +138,7 @@ public class TestNamespaceAuditor {
       .getMasterQuotaManager().isQuotaEnabled());
   }
 
-  @Test(timeout = 60000)
+  @Test
   public void testTableOperations() throws Exception {
     String nsp = prefix + "_np2";
     NamespaceDescriptor nspDesc =
@@ -480,7 +485,7 @@ public class TestNamespaceAuditor {
    * namespace quota cache. Now correct the failure and recreate the table with same name.
    * HBASE-13394
    */
-  @Test(timeout = 180000)
+  @Test
   public void testRecreateTableWithSameNameAfterFirstTimeFailure() throws Exception {
     String nsp1 = prefix + "_testRecreateTable";
     NamespaceDescriptor nspDesc =
@@ -659,7 +664,7 @@ public class TestNamespaceAuditor {
     observer.tableDeletionLatch.await();
   }
 
-  @Test(expected = QuotaExceededException.class, timeout = 30000)
+  @Test(expected = QuotaExceededException.class)
   public void testExceedTableQuotaInNamespace() throws Exception {
     String nsp = prefix + "_testExceedTableQuotaInNamespace";
     NamespaceDescriptor nspDesc =
@@ -676,7 +681,7 @@ public class TestNamespaceAuditor {
     ADMIN.createTable(tableDescTwo, Bytes.toBytes("AAA"), Bytes.toBytes("ZZZ"), 4);
   }
   
-  @Test(expected = QuotaExceededException.class, timeout = 30000)
+  @Test(expected = QuotaExceededException.class)
   public void testCloneSnapshotQuotaExceed() throws Exception {
     String nsp = prefix + "_testTableQuotaExceedWithCloneSnapshot";
     NamespaceDescriptor nspDesc =
@@ -694,7 +699,7 @@ public class TestNamespaceAuditor {
     ADMIN.deleteSnapshot(snapshot);
   }
 
-  @Test(timeout = 180000)
+  @Test
   public void testCloneSnapshot() throws Exception {
     String nsp = prefix + "_testCloneSnapshot";
     NamespaceDescriptor nspDesc =
@@ -729,7 +734,7 @@ public class TestNamespaceAuditor {
     ADMIN.deleteSnapshot(snapshot);
   }
 
-  @Test(timeout = 180000)
+  @Test
   public void testRestoreSnapshot() throws Exception {
     String nsp = prefix + "_testRestoreSnapshot";
     NamespaceDescriptor nspDesc =
@@ -763,7 +768,7 @@ public class TestNamespaceAuditor {
     ADMIN.deleteSnapshot(snapshot);
   }
 
-  @Test(timeout = 180000)
+  @Test
   public void testRestoreSnapshotQuotaExceed() throws Exception {
     String nsp = prefix + "_testRestoreSnapshotQuotaExceed";
     NamespaceDescriptor nspDesc =

http://git-wip-us.apache.org/repos/asf/hbase/blob/0f6ec611/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestScanner.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestScanner.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestScanner.java
index ad71bc7..8f0cd4c 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestScanner.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestScanner.java
@@ -33,6 +33,7 @@ import java.util.List;
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
+import org.apache.hadoop.hbase.CategoryBasedTimeout;
 import org.apache.hadoop.hbase.Cell;
 import org.apache.hadoop.hbase.CellUtil;
 import org.apache.hadoop.hbase.HBaseTestCase;
@@ -61,6 +62,7 @@ import org.junit.Rule;
 import org.junit.Test;
 import org.junit.experimental.categories.Category;
 import org.junit.rules.TestName;
+import org.junit.rules.TestRule;
 
 /**
  * Test of a long-lived scanner validating as we go.
@@ -68,6 +70,9 @@ import org.junit.rules.TestName;
 @Category({RegionServerTests.class, SmallTests.class})
 public class TestScanner {
   @Rule public TestName name = new TestName();
+  @Rule public final TestRule timeout = CategoryBasedTimeout.builder().
+      withTimeout(this.getClass()).withLookingForStuckThread(true).build();
+
   private static final Log LOG = LogFactory.getLog(TestScanner.class);
   private final static HBaseTestingUtility TEST_UTIL = HBaseTestingUtility.createLocalHTU();