diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestRegionServerReportForDuty.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestRegionServerReportForDuty.java index b72f4863558..de97c077bba 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestRegionServerReportForDuty.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestRegionServerReportForDuty.java @@ -23,6 +23,7 @@ import static org.junit.Assert.assertTrue; import java.io.IOException; import org.apache.hadoop.conf.Configuration; +import org.apache.hadoop.hbase.CategoryBasedTimeout; import org.apache.hadoop.hbase.CoordinatedStateManager; import org.apache.hadoop.hbase.HBaseTestingUtility; import org.apache.hadoop.hbase.HConstants; @@ -37,8 +38,10 @@ import org.apache.hadoop.hbase.util.JVMClusterUtil.RegionServerThread; import org.apache.zookeeper.KeeperException; 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.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -46,6 +49,9 @@ import org.slf4j.LoggerFactory; public class TestRegionServerReportForDuty { private static final Logger LOG = LoggerFactory.getLogger(TestRegionServerReportForDuty.class); + @Rule + public final TestRule timeout = CategoryBasedTimeout.builder().withTimeout(this.getClass()) + .withLookingForStuckThread(true).build(); private static final long SLEEP_INTERVAL = 500; @@ -77,7 +83,7 @@ public class TestRegionServerReportForDuty { * Tests region sever reportForDuty with backup master becomes primary master after * the first master goes away. */ - @Test (timeout=180000) + @Test public void testReportForDutyWithMasterChange() throws Exception { // Start a master and wait for it to become the active/primary master.