HBASE-22488 Cleanup the explicit timeout value for test methods

This commit is contained in:
Guanghao 2019-05-29 14:09:16 +08:00 committed by Guanghao Zhang
parent 6876199bac
commit 78319fab87
10 changed files with 38 additions and 28 deletions

View File

@ -185,7 +185,7 @@ public class TestLogLevel {
* Test client command line options. Does not validate server behavior. * Test client command line options. Does not validate server behavior.
* @throws Exception if commands return unexpected results. * @throws Exception if commands return unexpected results.
*/ */
@Test(timeout=120000) @Test
public void testCommandOptions() throws Exception { public void testCommandOptions() throws Exception {
final String className = this.getClass().getName(); final String className = this.getClass().getName();
@ -379,7 +379,7 @@ public class TestLogLevel {
* *
* @throws Exception if client can't set log level to INFO. * @throws Exception if client can't set log level to INFO.
*/ */
@Test(timeout=60000) @Test
public void testInfoLogLevel() throws Exception { public void testInfoLogLevel() throws Exception {
testDynamicLogLevel(LogLevel.PROTOCOL_HTTP, LogLevel.PROTOCOL_HTTP, true, "INFO"); testDynamicLogLevel(LogLevel.PROTOCOL_HTTP, LogLevel.PROTOCOL_HTTP, true, "INFO");
} }
@ -389,7 +389,7 @@ public class TestLogLevel {
* *
* @throws Exception if client can't set log level to ERROR. * @throws Exception if client can't set log level to ERROR.
*/ */
@Test(timeout=60000) @Test
public void testErrorLogLevel() throws Exception { public void testErrorLogLevel() throws Exception {
testDynamicLogLevel(LogLevel.PROTOCOL_HTTP, LogLevel.PROTOCOL_HTTP, true, "ERROR"); testDynamicLogLevel(LogLevel.PROTOCOL_HTTP, LogLevel.PROTOCOL_HTTP, true, "ERROR");
} }
@ -400,7 +400,7 @@ public class TestLogLevel {
* @throws Exception if http client can't access http server, * @throws Exception if http client can't access http server,
* or http client can access https server. * or http client can access https server.
*/ */
@Test(timeout=60000) @Test
public void testLogLevelByHttp() throws Exception { public void testLogLevelByHttp() throws Exception {
testDynamicLogLevel(LogLevel.PROTOCOL_HTTP, LogLevel.PROTOCOL_HTTP, false); testDynamicLogLevel(LogLevel.PROTOCOL_HTTP, LogLevel.PROTOCOL_HTTP, false);
try { try {
@ -419,7 +419,7 @@ public class TestLogLevel {
* @throws Exception if http client can't access http server, * @throws Exception if http client can't access http server,
* or http client can access https server. * or http client can access https server.
*/ */
@Test(timeout=60000) @Test
public void testLogLevelByHttpWithSpnego() throws Exception { public void testLogLevelByHttpWithSpnego() throws Exception {
testDynamicLogLevel(LogLevel.PROTOCOL_HTTP, LogLevel.PROTOCOL_HTTP, true); testDynamicLogLevel(LogLevel.PROTOCOL_HTTP, LogLevel.PROTOCOL_HTTP, true);
try { try {
@ -438,7 +438,7 @@ public class TestLogLevel {
* @throws Exception if https client can't access https server, * @throws Exception if https client can't access https server,
* or https client can access http server. * or https client can access http server.
*/ */
@Test(timeout=60000) @Test
public void testLogLevelByHttps() throws Exception { public void testLogLevelByHttps() throws Exception {
testDynamicLogLevel(LogLevel.PROTOCOL_HTTPS, LogLevel.PROTOCOL_HTTPS, testDynamicLogLevel(LogLevel.PROTOCOL_HTTPS, LogLevel.PROTOCOL_HTTPS,
false); false);
@ -459,7 +459,7 @@ public class TestLogLevel {
* @throws Exception if https client can't access https server, * @throws Exception if https client can't access https server,
* or https client can access http server. * or https client can access http server.
*/ */
@Test(timeout=60000) @Test
public void testLogLevelByHttpsWithSpnego() throws Exception { public void testLogLevelByHttpsWithSpnego() throws Exception {
testDynamicLogLevel(LogLevel.PROTOCOL_HTTPS, LogLevel.PROTOCOL_HTTPS, testDynamicLogLevel(LogLevel.PROTOCOL_HTTPS, LogLevel.PROTOCOL_HTTPS,
true); true);

View File

@ -99,7 +99,8 @@ public class TestSnapshotTemporaryDirectory {
* *
* @throws Exception on failure * @throws Exception on failure
*/ */
@BeforeClass public static void setupCluster() throws Exception { @BeforeClass
public static void setupCluster() throws Exception {
setupConf(UTIL.getConfiguration()); setupConf(UTIL.getConfiguration());
UTIL.startMiniCluster(NUM_RS); UTIL.startMiniCluster(NUM_RS);
admin = UTIL.getHBaseAdmin(); admin = UTIL.getHBaseAdmin();
@ -123,7 +124,8 @@ public class TestSnapshotTemporaryDirectory {
conf.set(SnapshotDescriptionUtils.SNAPSHOT_WORKING_DIR, "file://" + new Path(TEMP_DIR, ".tmpDir").toUri()); conf.set(SnapshotDescriptionUtils.SNAPSHOT_WORKING_DIR, "file://" + new Path(TEMP_DIR, ".tmpDir").toUri());
} }
@Before public void setup() throws Exception { @Before
public void setup() throws Exception {
HTableDescriptor htd = new HTableDescriptor(TABLE_NAME); HTableDescriptor htd = new HTableDescriptor(TABLE_NAME);
htd.setRegionReplication(getNumReplicas()); htd.setRegionReplication(getNumReplicas());
UTIL.createTable(htd, new byte[][] { TEST_FAM }, UTIL.getConfiguration()); UTIL.createTable(htd, new byte[][] { TEST_FAM }, UTIL.getConfiguration());
@ -133,13 +135,15 @@ public class TestSnapshotTemporaryDirectory {
return 1; return 1;
} }
@After public void tearDown() throws Exception { @After
public void tearDown() throws Exception {
UTIL.deleteTable(TABLE_NAME); UTIL.deleteTable(TABLE_NAME);
SnapshotTestingUtils.deleteAllSnapshots(UTIL.getHBaseAdmin()); SnapshotTestingUtils.deleteAllSnapshots(UTIL.getHBaseAdmin());
SnapshotTestingUtils.deleteArchiveDirectory(UTIL); SnapshotTestingUtils.deleteArchiveDirectory(UTIL);
} }
@AfterClass public static void cleanupTest() { @AfterClass
public static void cleanupTest() {
try { try {
UTIL.shutdownMiniCluster(); UTIL.shutdownMiniCluster();
FileUtils.deleteDirectory(new File(TEMP_DIR)); FileUtils.deleteDirectory(new File(TEMP_DIR));
@ -148,7 +152,8 @@ public class TestSnapshotTemporaryDirectory {
} }
} }
@Test(timeout = 180000) public void testRestoreDisabledSnapshot() @Test
public void testRestoreDisabledSnapshot()
throws IOException, InterruptedException { throws IOException, InterruptedException {
long tid = System.currentTimeMillis(); long tid = System.currentTimeMillis();
TableName tableName = TableName.valueOf("testtb-" + tid); TableName tableName = TableName.valueOf("testtb-" + tid);
@ -214,7 +219,8 @@ public class TestSnapshotTemporaryDirectory {
SnapshotTestingUtils.verifyReplicasCameOnline(tableName, admin, getNumReplicas()); SnapshotTestingUtils.verifyReplicasCameOnline(tableName, admin, getNumReplicas());
} }
@Test(timeout = 180000) public void testRestoreEnabledSnapshot() @Test
public void testRestoreEnabledSnapshot()
throws IOException, InterruptedException { throws IOException, InterruptedException {
long tid = System.currentTimeMillis(); long tid = System.currentTimeMillis();
TableName tableName = TableName.valueOf("testtb-" + tid); TableName tableName = TableName.valueOf("testtb-" + tid);
@ -281,7 +287,8 @@ public class TestSnapshotTemporaryDirectory {
* *
* @throws Exception if snapshot does not complete successfully * @throws Exception if snapshot does not complete successfully
*/ */
@Test(timeout = 300000) public void testOfflineTableSnapshot() throws Exception { @Test
public void testOfflineTableSnapshot() throws Exception {
Admin admin = UTIL.getHBaseAdmin(); Admin admin = UTIL.getHBaseAdmin();
// make sure we don't fail on listing snapshots // make sure we don't fail on listing snapshots
SnapshotTestingUtils.assertNoSnapshots(admin); SnapshotTestingUtils.assertNoSnapshots(admin);
@ -335,7 +342,8 @@ public class TestSnapshotTemporaryDirectory {
* *
* @throws Exception if snapshot does not complete successfully * @throws Exception if snapshot does not complete successfully
*/ */
@Test(timeout = 180000) public void testSnapshotCloneContents() throws Exception { @Test
public void testSnapshotCloneContents() throws Exception {
// make sure we don't fail on listing snapshots // make sure we don't fail on listing snapshots
SnapshotTestingUtils.assertNoSnapshots(admin); SnapshotTestingUtils.assertNoSnapshots(admin);
@ -371,7 +379,8 @@ public class TestSnapshotTemporaryDirectory {
admin.close(); admin.close();
} }
@Test(timeout = 180000) public void testOfflineTableSnapshotWithEmptyRegion() throws Exception { @Test
public void testOfflineTableSnapshotWithEmptyRegion() throws Exception {
// test with an empty table with one region // test with an empty table with one region
// make sure we don't fail on listing snapshots // make sure we don't fail on listing snapshots
@ -416,7 +425,8 @@ public class TestSnapshotTemporaryDirectory {
} }
// Ensures that the snapshot is transferred to the proper completed snapshot directory // Ensures that the snapshot is transferred to the proper completed snapshot directory
@Test(timeout = 180000) public void testEnsureTemporaryDirectoryTransfer() throws Exception { @Test
public void testEnsureTemporaryDirectoryTransfer() throws Exception {
Admin admin = null; Admin admin = null;
TableName tableName2 = TableName.valueOf("testListTableSnapshots"); TableName tableName2 = TableName.valueOf("testListTableSnapshots");
try { try {
@ -468,4 +478,4 @@ public class TestSnapshotTemporaryDirectory {
manifestVersion); manifestVersion);
admin.snapshot(desc); admin.snapshot(desc);
} }
} }

View File

@ -232,7 +232,7 @@ public class TestMetaTableMetrics {
assertEquals(5L, putWithClientMetricsCount); assertEquals(5L, putWithClientMetricsCount);
} }
@Test(timeout = 30000) @Test
public void testConcurrentAccess() { public void testConcurrentAccess() {
try { try {
tablename = Bytes.toBytes("hbase:meta"); tablename = Bytes.toBytes("hbase:meta");

View File

@ -63,7 +63,7 @@ public class TestMasterHandlerFullWhenTransitRegion {
UTIL.createTable(TableName.valueOf(TABLENAME), "fa"); UTIL.createTable(TableName.valueOf(TABLENAME), "fa");
} }
@Test(timeout = 30000) @Test
public void test() throws Exception { public void test() throws Exception {
RegionInfo regionInfo = UTIL.getAdmin().getRegions(TableName.valueOf(TABLENAME)).get(0); RegionInfo regionInfo = UTIL.getAdmin().getRegions(TableName.valueOf(TABLENAME)).get(0);
//See HBASE-21754 //See HBASE-21754

View File

@ -309,7 +309,7 @@ public class TestMasterNoCluster {
} }
} }
@Test(timeout = 60000) @Test
public void testMasterInitWithSameClientServerZKQuorum() throws Exception { public void testMasterInitWithSameClientServerZKQuorum() throws Exception {
Configuration conf = new Configuration(TESTUTIL.getConfiguration()); Configuration conf = new Configuration(TESTUTIL.getConfiguration());
conf.set(HConstants.CLIENT_ZOOKEEPER_QUORUM, HConstants.LOCALHOST); conf.set(HConstants.CLIENT_ZOOKEEPER_QUORUM, HConstants.LOCALHOST);
@ -320,7 +320,7 @@ public class TestMasterNoCluster {
master.join(); master.join();
} }
@Test(timeout = 60000) @Test
public void testMasterInitWithObserverModeClientZKQuorum() throws Exception { public void testMasterInitWithObserverModeClientZKQuorum() throws Exception {
Configuration conf = new Configuration(TESTUTIL.getConfiguration()); Configuration conf = new Configuration(TESTUTIL.getConfiguration());
Assert.assertFalse(Boolean.getBoolean(HConstants.CLIENT_ZOOKEEPER_OBSERVER_MODE)); Assert.assertFalse(Boolean.getBoolean(HConstants.CLIENT_ZOOKEEPER_OBSERVER_MODE));

View File

@ -261,7 +261,7 @@ public class TestLogsCleaner {
* When zk is working both files should be returned * When zk is working both files should be returned
* @throws Exception from ZK watcher * @throws Exception from ZK watcher
*/ */
@Test(timeout=10000) @Test
public void testZooKeeperNormal() throws Exception { public void testZooKeeperNormal() throws Exception {
ReplicationLogCleaner cleaner = new ReplicationLogCleaner(); ReplicationLogCleaner cleaner = new ReplicationLogCleaner();

View File

@ -203,7 +203,7 @@ public class TestQuotaState {
assertNoopLimiter(quotaInfo.getTableLimiter(UNKNOWN_TABLE_NAME)); assertNoopLimiter(quotaInfo.getTableLimiter(UNKNOWN_TABLE_NAME));
} }
@Test(timeout = 60000) @Test
public void testTableThrottleWithBatch() { public void testTableThrottleWithBatch() {
final TableName TABLE_A = TableName.valueOf("TableA"); final TableName TABLE_A = TableName.valueOf("TableA");
final int TABLE_A_THROTTLE_1 = 3; final int TABLE_A_THROTTLE_1 = 3;

View File

@ -313,7 +313,7 @@ public class TestWALLockup {
* If below is broken, we will see this test timeout because RingBufferEventHandler was stuck in * If below is broken, we will see this test timeout because RingBufferEventHandler was stuck in
* attainSafePoint. Everyone will wait for sync to finish forever. See HBASE-14317. * attainSafePoint. Everyone will wait for sync to finish forever. See HBASE-14317.
*/ */
@Test (timeout=30000) @Test
public void testRingBufferEventHandlerStuckWhenSyncFailed() public void testRingBufferEventHandlerStuckWhenSyncFailed()
throws IOException, InterruptedException { throws IOException, InterruptedException {

View File

@ -52,7 +52,7 @@ public class TestStoreHotnessProtector {
@ClassRule public static final HBaseClassTestRule CLASS_RULE = @ClassRule public static final HBaseClassTestRule CLASS_RULE =
HBaseClassTestRule.forClass(TestStoreHotnessProtector.class); HBaseClassTestRule.forClass(TestStoreHotnessProtector.class);
@Test(timeout = 60000) @Test
public void testPreparePutCounter() throws Exception { public void testPreparePutCounter() throws Exception {
ExecutorService executorService = Executors.newFixedThreadPool(10); ExecutorService executorService = Executors.newFixedThreadPool(10);

View File

@ -3162,7 +3162,7 @@ public class TestAccessController extends SecureTestUtil {
verifyDenied(action, USER_CREATE, USER_RW, USER_RO, USER_NONE, USER_OWNER, USER_ADMIN); verifyDenied(action, USER_CREATE, USER_RW, USER_RO, USER_NONE, USER_OWNER, USER_ADMIN);
} }
@Test(timeout = 180000) @Test
public void testGetUserPermissions() throws Throwable { public void testGetUserPermissions() throws Throwable {
Connection conn = null; Connection conn = null;
try { try {
@ -3290,7 +3290,7 @@ public class TestAccessController extends SecureTestUtil {
} }
} }
@Test(timeout = 180000) @Test
public void testHasPermission() throws Throwable { public void testHasPermission() throws Throwable {
Connection conn = null; Connection conn = null;
try { try {