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/30 17:54:02 UTC
[03/17] hbase git commit: HBASE-14720 Make TestHCM and
TestMetaWithReplicas large tests rather than mediums
HBASE-14720 Make TestHCM and TestMetaWithReplicas large tests rather than mediums
Project: http://git-wip-us.apache.org/repos/asf/hbase/repo
Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/452e38ff
Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/452e38ff
Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/452e38ff
Branch: refs/heads/hbase-12439
Commit: 452e38ff8029ea403c1dcbc5ce9906d96b02f992
Parents: 2288742
Author: stack <st...@apache.org>
Authored: Thu Oct 29 10:28:28 2015 -0700
Committer: stack <st...@apache.org>
Committed: Thu Oct 29 10:28:40 2015 -0700
----------------------------------------------------------------------
.../org/apache/hadoop/hbase/client/TestHCM.java | 37 ++++++++++----------
.../hbase/client/TestMetaWithReplicas.java | 23 +++++++-----
.../client/TestRestoreSnapshotFromClient.java | 12 ++++---
3 files changed, 41 insertions(+), 31 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/hbase/blob/452e38ff/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestHCM.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestHCM.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestHCM.java
index 041b19f..a9b85c7 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestHCM.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestHCM.java
@@ -65,7 +65,7 @@ import org.apache.hadoop.hbase.master.HMaster;
import org.apache.hadoop.hbase.regionserver.HRegionServer;
import org.apache.hadoop.hbase.regionserver.Region;
import org.apache.hadoop.hbase.regionserver.RegionServerStoppedException;
-import org.apache.hadoop.hbase.testclassification.MediumTests;
+import org.apache.hadoop.hbase.testclassification.LargeTests;
import org.apache.hadoop.hbase.util.Bytes;
import org.apache.hadoop.hbase.util.EnvironmentEdgeManager;
import org.apache.hadoop.hbase.util.JVMClusterUtil;
@@ -85,7 +85,7 @@ import com.google.common.collect.Lists;
/**
* This class is for testing HBaseConnectionManager features
*/
-@Category({MediumTests.class})
+@Category({LargeTests.class})
public class TestHCM {
@Rule public final TestRule timeout = CategoryBasedTimeout.builder()
.withTimeout(this.getClass())
@@ -139,7 +139,7 @@ public class TestHCM {
TEST_UTIL.shutdownMiniCluster();
}
- @Test (timeout=120000)
+ @Test
public void testClusterConnection() throws IOException {
ThreadPoolExecutor otherPool = new ThreadPoolExecutor(1, 1,
5, TimeUnit.SECONDS,
@@ -203,7 +203,7 @@ public class TestHCM {
* Naive test to check that HConnection#getAdmin returns a properly constructed HBaseAdmin object
* @throws IOException Unable to construct admin
*/
- @Test (timeout=120000)
+ @Test
public void testAdminFactory() throws IOException {
Connection con1 = ConnectionFactory.createConnection(TEST_UTIL.getConfiguration());
Admin admin = con1.getAdmin();
@@ -277,12 +277,12 @@ public class TestHCM {
* Test that we can handle connection close: it will trigger a retry, but the calls will
* finish.
*/
- @Test (timeout=120000)
+ @Test
public void testConnectionCloseAllowsInterrupt() throws Exception {
testConnectionClose(true);
}
- @Test (timeout=120000)
+ @Test
public void testConnectionNotAllowsInterrupt() throws Exception {
testConnectionClose(false);
}
@@ -295,7 +295,7 @@ public class TestHCM {
* succeeds. But the client won't wait that much, because 20 + 20 > 30, so the client
* timeouted when the server answers.
*/
- @Test (timeout=120000)
+ @Test
public void testOperationTimeout() throws Exception {
HTableDescriptor hdt = TEST_UTIL.createTableDescriptor("HCM-testOperationTimeout");
hdt.addCoprocessor(SleepAndFailFirstTime.class.getName());
@@ -413,7 +413,7 @@ public class TestHCM {
/**
* Test that connection can become idle without breaking everything.
*/
- @Test (timeout=120000)
+ @Test
public void testConnectionIdle() throws Exception {
TableName tableName = TableName.valueOf("HCM-testConnectionIdle");
TEST_UTIL.createTable(tableName, FAM_NAM).close();
@@ -474,7 +474,7 @@ public class TestHCM {
* notification.
* @throws Exception
*/
- @Test (timeout=120000)
+ @Test
public void testConnectionCut() throws Exception {
TableName tableName = TableName.valueOf("HCM-testConnectionCut");
@@ -572,7 +572,7 @@ public class TestHCM {
* that we really delete it.
* @throws Exception
*/
- @Test (timeout=120000)
+ @Test
public void testRegionCaching() throws Exception{
TEST_UTIL.createMultiRegionTable(TABLE_NAME, FAM_NAM).close();
Configuration conf = new Configuration(TEST_UTIL.getConfiguration());
@@ -760,7 +760,7 @@ public class TestHCM {
* Test that Connection or Pool are not closed when managed externally
* @throws Exception
*/
- @Test (timeout=120000)
+ @Test
public void testConnectionManagement() throws Exception{
Table table0 = TEST_UTIL.createTable(TABLE_NAME1, FAM_NAM);
Connection conn = ConnectionFactory.createConnection(TEST_UTIL.getConfiguration());
@@ -779,7 +779,7 @@ public class TestHCM {
/**
* Test that stale cache updates don't override newer cached values.
*/
- @Test(timeout = 60000)
+ @Test
public void testCacheSeqNums() throws Exception{
Table table = TEST_UTIL.createMultiRegionTable(TABLE_NAME2, FAM_NAM);
Put put = new Put(ROW);
@@ -822,7 +822,7 @@ public class TestHCM {
table.close();
}
- @Test (timeout=120000)
+ @Test
public void testClosing() throws Exception {
Configuration configuration =
new Configuration(TEST_UTIL.getConfiguration());
@@ -850,7 +850,7 @@ public class TestHCM {
* Trivial test to verify that nobody messes with
* {@link ConnectionFactory#createConnection(Configuration)}
*/
- @Test (timeout=120000)
+ @Test
public void testCreateConnection() throws Exception {
Configuration configuration = TEST_UTIL.getConfiguration();
Connection c1 = ConnectionFactory.createConnection(configuration);
@@ -865,7 +865,7 @@ public class TestHCM {
* ZooKeeper quorum set. Other stuff like master address will be read
* from ZK by the client.
*/
- @Test(timeout = 60000)
+ @Test
public void testConnection() throws Exception{
// We create an empty config and add the ZK address.
Configuration c = new Configuration();
@@ -892,7 +892,7 @@ public class TestHCM {
return prevNumRetriesVal;
}
- @Test (timeout=30000)
+ @Test
public void testMulti() throws Exception {
Table table = TEST_UTIL.createMultiRegionTable(TABLE_NAME3, FAM_NAM);
try {
@@ -1073,7 +1073,7 @@ public class TestHCM {
Math.abs(actual - expected) <= (0.01f * jitterBase));
}
- @Test(timeout = 60000)
+ @Test
public void testConnectionRideOverClusterRestart() throws IOException, InterruptedException {
Configuration config = new Configuration(TEST_UTIL.getConfiguration());
@@ -1095,5 +1095,4 @@ public class TestHCM {
table.close();
connection.close();
}
-}
-
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/hbase/blob/452e38ff/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestMetaWithReplicas.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestMetaWithReplicas.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestMetaWithReplicas.java
index 0e5bd9c..9173dc5 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestMetaWithReplicas.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestMetaWithReplicas.java
@@ -18,7 +18,10 @@
*/
package org.apache.hadoop.hbase.client;
-import javax.annotation.Nullable;
+import static org.apache.hadoop.hbase.util.hbck.HbckTestingUtil.assertErrors;
+import static org.apache.hadoop.hbase.util.hbck.HbckTestingUtil.doFsck;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
import java.io.IOException;
import java.util.Arrays;
@@ -26,10 +29,13 @@ import java.util.Collection;
import java.util.List;
import java.util.concurrent.ExecutorService;
+import javax.annotation.Nullable;
+
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.hbase.Abortable;
+import org.apache.hadoop.hbase.CategoryBasedTimeout;
import org.apache.hadoop.hbase.HBaseTestingUtility;
import org.apache.hadoop.hbase.HConstants;
import org.apache.hadoop.hbase.HRegionInfo;
@@ -41,7 +47,7 @@ import org.apache.hadoop.hbase.TableName;
import org.apache.hadoop.hbase.TableNotFoundException;
import org.apache.hadoop.hbase.Waiter;
import org.apache.hadoop.hbase.regionserver.StorefileRefresherChore;
-import org.apache.hadoop.hbase.testclassification.MediumTests;
+import org.apache.hadoop.hbase.testclassification.LargeTests;
import org.apache.hadoop.hbase.util.Bytes;
import org.apache.hadoop.hbase.util.HBaseFsck;
import org.apache.hadoop.hbase.util.HBaseFsck.ErrorReporter.ERROR_CODE;
@@ -53,19 +59,20 @@ import org.apache.hadoop.hbase.zookeeper.ZooKeeperWatcher;
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 static org.apache.hadoop.hbase.util.hbck.HbckTestingUtil.assertErrors;
-import static org.apache.hadoop.hbase.util.hbck.HbckTestingUtil.doFsck;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
+import org.junit.rules.TestRule;
/**
* Tests the scenarios where replicas are enabled for the meta table
*/
-@Category(MediumTests.class)
+@Category(LargeTests.class)
public class TestMetaWithReplicas {
+ @Rule public final TestRule timeout = CategoryBasedTimeout.builder().
+ withTimeout(this.getClass()).
+ withLookingForStuckThread(true).
+ build();
private static final Log LOG = LogFactory.getLog(TestMetaWithReplicas.class);
private final HBaseTestingUtility TEST_UTIL = new HBaseTestingUtility();
http://git-wip-us.apache.org/repos/asf/hbase/blob/452e38ff/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestRestoreSnapshotFromClient.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestRestoreSnapshotFromClient.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestRestoreSnapshotFromClient.java
index 3b973b0..d31df42 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestRestoreSnapshotFromClient.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestRestoreSnapshotFromClient.java
@@ -25,15 +25,14 @@ import java.io.IOException;
import java.util.HashSet;
import java.util.Set;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.Path;
-import org.apache.hadoop.hbase.TableName;
+import org.apache.hadoop.hbase.CategoryBasedTimeout;
import org.apache.hadoop.hbase.HBaseTestingUtility;
import org.apache.hadoop.hbase.HColumnDescriptor;
import org.apache.hadoop.hbase.HConstants;
import org.apache.hadoop.hbase.HTableDescriptor;
+import org.apache.hadoop.hbase.TableName;
import org.apache.hadoop.hbase.master.MasterFileSystem;
import org.apache.hadoop.hbase.master.snapshot.SnapshotManager;
import org.apache.hadoop.hbase.regionserver.NoSuchColumnFamilyException;
@@ -47,15 +46,20 @@ import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
+import org.junit.Rule;
import org.junit.Test;
import org.junit.experimental.categories.Category;
+import org.junit.rules.TestRule;
/**
* Test restore snapshots from the client
*/
@Category({LargeTests.class, ClientTests.class})
public class TestRestoreSnapshotFromClient {
- private static final Log LOG = LogFactory.getLog(TestRestoreSnapshotFromClient.class);
+ @Rule public final TestRule timeout = CategoryBasedTimeout.builder()
+ .withTimeout(this.getClass())
+ .withLookingForStuckThread(true)
+ .build();
protected final static HBaseTestingUtility TEST_UTIL = new HBaseTestingUtility();