HBASE-19866 Add cateogry based timeout using Timeout Rule to TestRegionServerReportForDuty.

This commit is contained in:
Apekshit Sharma 2018-01-26 00:30:56 -08:00
parent f8295a810d
commit c16dae13f2
1 changed files with 7 additions and 1 deletions

View File

@ -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.