You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by ec...@apache.org on 2016/04/08 21:32:04 UTC

[12/52] [abbrv] hbase git commit: HBASE-15566 Add timeouts on TestMobFlushSnapshotFromClient and TestRegionMergeTransactionOnCluster

HBASE-15566 Add timeouts on TestMobFlushSnapshotFromClient and TestRegionMergeTransactionOnCluster


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

Branch: refs/heads/HBASE-14850
Commit: 21301a8a956285179b59b309a31d1155c6673e25
Parents: a71ce6e
Author: stack <st...@apache.org>
Authored: Wed Mar 30 13:23:20 2016 -0700
Committer: stack <st...@apache.org>
Committed: Wed Mar 30 13:23:20 2016 -0700

----------------------------------------------------------------------
 .../TestMasterFailoverWithProcedures.java       | 39 ++++++++------------
 .../TestMobFlushSnapshotFromClient.java         |  5 +++
 2 files changed, 21 insertions(+), 23 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hbase/blob/21301a8a/hbase-server/src/test/java/org/apache/hadoop/hbase/master/procedure/TestMasterFailoverWithProcedures.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/master/procedure/TestMasterFailoverWithProcedures.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/master/procedure/TestMasterFailoverWithProcedures.java
index 125f5a1..e880cd1 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/master/procedure/TestMasterFailoverWithProcedures.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/master/procedure/TestMasterFailoverWithProcedures.java
@@ -18,14 +18,18 @@
 
 package org.apache.hadoop.hbase.master.procedure;
 
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
 import java.io.IOException;
 import java.util.concurrent.CountDownLatch;
 
 import org.apache.commons.logging.Log;
 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.HBaseTestingUtility;
 import org.apache.hadoop.hbase.HRegionInfo;
 import org.apache.hadoop.hbase.HTableDescriptor;
@@ -43,24 +47,24 @@ import org.apache.hadoop.hbase.protobuf.generated.MasterProcedureProtos.DeleteTa
 import org.apache.hadoop.hbase.protobuf.generated.MasterProcedureProtos.DisableTableState;
 import org.apache.hadoop.hbase.protobuf.generated.MasterProcedureProtos.EnableTableState;
 import org.apache.hadoop.hbase.protobuf.generated.MasterProcedureProtos.TruncateTableState;
-import org.apache.hadoop.hbase.testclassification.MasterTests;
 import org.apache.hadoop.hbase.testclassification.LargeTests;
+import org.apache.hadoop.hbase.testclassification.MasterTests;
 import org.apache.hadoop.hbase.util.Bytes;
 import org.apache.hadoop.hbase.util.FSUtils;
 import org.apache.hadoop.hbase.util.ModifyRegionUtils;
 import org.junit.After;
 import org.junit.Before;
+import org.junit.Rule;
 import org.junit.Test;
 import org.junit.experimental.categories.Category;
+import org.junit.rules.TestRule;
 import org.mockito.Mockito;
 
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
-
 @Category({MasterTests.class, LargeTests.class})
 public class TestMasterFailoverWithProcedures {
   private static final Log LOG = LogFactory.getLog(TestMasterFailoverWithProcedures.class);
+  @Rule public final TestRule timeout = CategoryBasedTimeout.builder().withTimeout(this.getClass()).
+      withLookingForStuckThread(true).build();
 
   protected static final HBaseTestingUtility UTIL = new HBaseTestingUtility();
 
@@ -91,7 +95,7 @@ public class TestMasterFailoverWithProcedures {
     }
   }
 
-  @Test(timeout=60000)
+  @Test
   public void testWalRecoverLease() throws Exception {
     final ProcedureStore masterStore = getMasterProcedureExecutor().getStore();
     assertTrue("expected WALStore for this test", masterStore instanceof WALProcedureStore);
@@ -232,7 +236,7 @@ public class TestMasterFailoverWithProcedures {
   // ==========================================================================
   //  Test Create Table
   // ==========================================================================
-  @Test(timeout=60000)
+  @Test
   public void testCreateWithFailover() throws Exception {
     // TODO: Should we try every step? (master failover takes long time)
     // It is already covered by TestCreateTableProcedure
@@ -265,7 +269,7 @@ public class TestMasterFailoverWithProcedures {
   // ==========================================================================
   //  Test Delete Table
   // ==========================================================================
-  @Test(timeout=60000)
+  @Test
   public void testDeleteWithFailover() throws Exception {
     // TODO: Should we try every step? (master failover takes long time)
     // It is already covered by TestDeleteTableProcedure
@@ -303,7 +307,7 @@ public class TestMasterFailoverWithProcedures {
   // ==========================================================================
   //  Test Truncate Table
   // ==========================================================================
-  @Test(timeout=90000)
+  @Test
   public void testTruncateWithFailover() throws Exception {
     // TODO: Should we try every step? (master failover takes long time)
     // It is already covered by TestTruncateTableProcedure
@@ -364,7 +368,7 @@ public class TestMasterFailoverWithProcedures {
   // ==========================================================================
   //  Test Disable Table
   // ==========================================================================
-  @Test(timeout=60000)
+  @Test
   public void testDisableTableWithFailover() throws Exception {
     // TODO: Should we try every step? (master failover takes long time)
     // It is already covered by TestDisableTableProcedure
@@ -400,7 +404,7 @@ public class TestMasterFailoverWithProcedures {
   // ==========================================================================
   //  Test Enable Table
   // ==========================================================================
-  @Test(timeout=60000)
+  @Test
   public void testEnableTableWithFailover() throws Exception {
     // TODO: Should we try every step? (master failover takes long time)
     // It is already covered by TestEnableTableProcedure
@@ -492,23 +496,12 @@ public class TestMasterFailoverWithProcedures {
   // ==========================================================================
   //  Helpers
   // ==========================================================================
-  private MasterProcedureEnv getMasterProcedureEnv() {
-    return getMasterProcedureExecutor().getEnvironment();
-  }
 
   private ProcedureExecutor<MasterProcedureEnv> getMasterProcedureExecutor() {
     return UTIL.getHBaseCluster().getMaster().getMasterProcedureExecutor();
   }
 
-  private FileSystem getFileSystem() {
-    return UTIL.getHBaseCluster().getMaster().getMasterFileSystem().getFileSystem();
-  }
-
   private Path getRootDir() {
     return UTIL.getHBaseCluster().getMaster().getMasterFileSystem().getRootDir();
   }
-
-  private Path getTempDir() {
-    return UTIL.getHBaseCluster().getMaster().getMasterFileSystem().getTempDir();
-  }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/hbase/blob/21301a8a/hbase-server/src/test/java/org/apache/hadoop/hbase/snapshot/TestMobFlushSnapshotFromClient.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/snapshot/TestMobFlushSnapshotFromClient.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/snapshot/TestMobFlushSnapshotFromClient.java
index fe297edc..6e612ba 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/snapshot/TestMobFlushSnapshotFromClient.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/snapshot/TestMobFlushSnapshotFromClient.java
@@ -22,6 +22,7 @@ import java.io.IOException;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.hbase.CategoryBasedTimeout;
 import org.apache.hadoop.hbase.HBaseTestingUtility;
 import org.apache.hadoop.hbase.TableName;
 import org.apache.hadoop.hbase.client.Table;
@@ -29,7 +30,9 @@ import org.apache.hadoop.hbase.mob.MobConstants;
 import org.apache.hadoop.hbase.testclassification.ClientTests;
 import org.apache.hadoop.hbase.testclassification.LargeTests;
 import org.junit.BeforeClass;
+import org.junit.Rule;
 import org.junit.experimental.categories.Category;
+import org.junit.rules.TestRule;
 
 /**
  * Test creating/using/deleting snapshots from the client
@@ -42,6 +45,8 @@ import org.junit.experimental.categories.Category;
 @Category({ClientTests.class, LargeTests.class})
 public class TestMobFlushSnapshotFromClient extends TestFlushSnapshotFromClient {
   private static final Log LOG = LogFactory.getLog(TestFlushSnapshotFromClient.class);
+  @Rule public final TestRule timeout = CategoryBasedTimeout.builder().withTimeout(this.getClass()).
+      withLookingForStuckThread(true).build();
 
   @BeforeClass
   public static void setupCluster() throws Exception {