HBASE-14720 Make TestHCM and TestMetaWithReplicas large tests rather than mediums

This commit is contained in:
stack 2015-10-29 10:28:28 -07:00
parent 45faf38028
commit 066f3f7545
3 changed files with 43 additions and 27 deletions

View File

@ -70,7 +70,7 @@ import org.apache.hadoop.hbase.master.HMaster;
import org.apache.hadoop.hbase.regionserver.HRegionServer; import org.apache.hadoop.hbase.regionserver.HRegionServer;
import org.apache.hadoop.hbase.regionserver.Region; import org.apache.hadoop.hbase.regionserver.Region;
import org.apache.hadoop.hbase.regionserver.RegionServerStoppedException; 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.Bytes;
import org.apache.hadoop.hbase.util.EnvironmentEdgeManager; import org.apache.hadoop.hbase.util.EnvironmentEdgeManager;
import org.apache.hadoop.hbase.util.JVMClusterUtil; import org.apache.hadoop.hbase.util.JVMClusterUtil;
@ -91,7 +91,7 @@ import com.google.common.collect.Lists;
/** /**
* This class is for testing HBaseConnectionManager features * This class is for testing HBaseConnectionManager features
*/ */
@Category(MediumTests.class) @Category({LargeTests.class})
public class TestHCM { public class TestHCM {
@Rule public final TestRule timeout = CategoryBasedTimeout.builder() @Rule public final TestRule timeout = CategoryBasedTimeout.builder()
.withTimeout(this.getClass()) .withTimeout(this.getClass())
@ -150,7 +150,7 @@ public class TestHCM {
return HConnectionTestingUtility.getConnectionCount(); return HConnectionTestingUtility.getConnectionCount();
} }
@Test (timeout=120000) @Test
public void testClusterConnection() throws IOException { public void testClusterConnection() throws IOException {
ThreadPoolExecutor otherPool = new ThreadPoolExecutor(1, 1, ThreadPoolExecutor otherPool = new ThreadPoolExecutor(1, 1,
5, TimeUnit.SECONDS, 5, TimeUnit.SECONDS,
@ -213,7 +213,7 @@ public class TestHCM {
* Naive test to check that HConnection#getAdmin returns a properly constructed HBaseAdmin object * Naive test to check that HConnection#getAdmin returns a properly constructed HBaseAdmin object
* @throws IOException Unable to construct admin * @throws IOException Unable to construct admin
*/ */
@Test (timeout=120000) @Test
public void testAdminFactory() throws IOException { public void testAdminFactory() throws IOException {
Connection con1 = ConnectionFactory.createConnection(TEST_UTIL.getConfiguration()); Connection con1 = ConnectionFactory.createConnection(TEST_UTIL.getConfiguration());
Admin admin = con1.getAdmin(); Admin admin = con1.getAdmin();
@ -285,12 +285,12 @@ public class TestHCM {
* Test that we can handle connection close: it will trigger a retry, but the calls will * Test that we can handle connection close: it will trigger a retry, but the calls will
* finish. * finish.
*/ */
@Test (timeout=120000) @Test
public void testConnectionCloseAllowsInterrupt() throws Exception { public void testConnectionCloseAllowsInterrupt() throws Exception {
testConnectionClose(true); testConnectionClose(true);
} }
@Test (timeout=120000) @Test
public void testConnectionNotAllowsInterrupt() throws Exception { public void testConnectionNotAllowsInterrupt() throws Exception {
testConnectionClose(false); testConnectionClose(false);
} }
@ -303,7 +303,7 @@ public class TestHCM {
* succeeds. But the client won't wait that much, because 20 + 20 > 30, so the client * succeeds. But the client won't wait that much, because 20 + 20 > 30, so the client
* timeouted when the server answers. * timeouted when the server answers.
*/ */
@Test (timeout=120000) @Test
public void testOperationTimeout() throws Exception { public void testOperationTimeout() throws Exception {
HTableDescriptor hdt = TEST_UTIL.createTableDescriptor("HCM-testOperationTimeout"); HTableDescriptor hdt = TEST_UTIL.createTableDescriptor("HCM-testOperationTimeout");
hdt.addCoprocessor(SleepAndFailFirstTime.class.getName()); hdt.addCoprocessor(SleepAndFailFirstTime.class.getName());
@ -412,7 +412,7 @@ public class TestHCM {
/** /**
* Test that connection can become idle without breaking everything. * Test that connection can become idle without breaking everything.
*/ */
@Test (timeout=120000) @Test
public void testConnectionIdle() throws Exception { public void testConnectionIdle() throws Exception {
TableName tableName = TableName.valueOf("HCM-testConnectionIdle"); TableName tableName = TableName.valueOf("HCM-testConnectionIdle");
TEST_UTIL.createTable(tableName, FAM_NAM).close(); TEST_UTIL.createTable(tableName, FAM_NAM).close();
@ -470,7 +470,7 @@ public class TestHCM {
* notification. * notification.
* @throws Exception * @throws Exception
*/ */
@Test (timeout=120000) @Test
public void testConnectionCut() throws Exception { public void testConnectionCut() throws Exception {
TableName tableName = TableName.valueOf("HCM-testConnectionCut"); TableName tableName = TableName.valueOf("HCM-testConnectionCut");
@ -584,7 +584,7 @@ public class TestHCM {
* that we really delete it. * that we really delete it.
* @throws Exception * @throws Exception
*/ */
@Test (timeout=120000) @Test
public void testRegionCaching() throws Exception{ public void testRegionCaching() throws Exception{
TEST_UTIL.createMultiRegionTable(TABLE_NAME, FAM_NAM).close(); TEST_UTIL.createMultiRegionTable(TABLE_NAME, FAM_NAM).close();
Configuration conf = new Configuration(TEST_UTIL.getConfiguration()); Configuration conf = new Configuration(TEST_UTIL.getConfiguration());
@ -770,7 +770,7 @@ public class TestHCM {
* Test that Connection or Pool are not closed when managed externally * Test that Connection or Pool are not closed when managed externally
* @throws Exception * @throws Exception
*/ */
@Test (timeout=120000) @Test
public void testConnectionManagement() throws Exception{ public void testConnectionManagement() throws Exception{
Table table0 = TEST_UTIL.createTable(TABLE_NAME1, FAM_NAM); Table table0 = TEST_UTIL.createTable(TABLE_NAME1, FAM_NAM);
Connection conn = ConnectionFactory.createConnection(TEST_UTIL.getConfiguration()); Connection conn = ConnectionFactory.createConnection(TEST_UTIL.getConfiguration());
@ -789,7 +789,7 @@ public class TestHCM {
/** /**
* Test that stale cache updates don't override newer cached values. * Test that stale cache updates don't override newer cached values.
*/ */
@Test(timeout = 60000) @Test
public void testCacheSeqNums() throws Exception{ public void testCacheSeqNums() throws Exception{
HTable table = TEST_UTIL.createMultiRegionTable(TABLE_NAME2, FAM_NAM); HTable table = TEST_UTIL.createMultiRegionTable(TABLE_NAME2, FAM_NAM);
Put put = new Put(ROW); Put put = new Put(ROW);
@ -837,7 +837,7 @@ public class TestHCM {
* Make sure that {@link Configuration} instances that are essentially the * Make sure that {@link Configuration} instances that are essentially the
* same map to the same {@link HConnection} instance. * same map to the same {@link HConnection} instance.
*/ */
@Test (timeout=120000) @Test
public void testConnectionSameness() throws Exception { public void testConnectionSameness() throws Exception {
Connection previousConnection = null; Connection previousConnection = null;
for (int i = 0; i < 2; i++) { for (int i = 0; i < 2; i++) {
@ -869,7 +869,7 @@ public class TestHCM {
* @deprecated Tests deprecated functionality. Remove in 1.0. * @deprecated Tests deprecated functionality. Remove in 1.0.
*/ */
@Deprecated @Deprecated
@Test (timeout=120000) @Test
public void testConnectionUniqueness() throws Exception { public void testConnectionUniqueness() throws Exception {
int zkmaxconnections = TEST_UTIL.getConfiguration(). int zkmaxconnections = TEST_UTIL.getConfiguration().
getInt(HConstants.ZOOKEEPER_MAX_CLIENT_CNXNS, getInt(HConstants.ZOOKEEPER_MAX_CLIENT_CNXNS,
@ -915,7 +915,7 @@ public class TestHCM {
} }
} }
@Test (timeout=120000) @Test
public void testClosing() throws Exception { public void testClosing() throws Exception {
Configuration configuration = Configuration configuration =
new Configuration(TEST_UTIL.getConfiguration()); new Configuration(TEST_UTIL.getConfiguration());
@ -955,7 +955,7 @@ public class TestHCM {
* Trivial test to verify that nobody messes with * Trivial test to verify that nobody messes with
* {@link HConnectionManager#createConnection(Configuration)} * {@link HConnectionManager#createConnection(Configuration)}
*/ */
@Test (timeout=120000) @Test
public void testCreateConnection() throws Exception { public void testCreateConnection() throws Exception {
Configuration configuration = TEST_UTIL.getConfiguration(); Configuration configuration = TEST_UTIL.getConfiguration();
Connection c1 = ConnectionFactory.createConnection(configuration); Connection c1 = ConnectionFactory.createConnection(configuration);
@ -975,7 +975,7 @@ public class TestHCM {
* ZooKeeper quorum set. Other stuff like master address will be read * ZooKeeper quorum set. Other stuff like master address will be read
* from ZK by the client. * from ZK by the client.
*/ */
@Test(timeout = 60000) @Test
public void testConnection() throws Exception{ public void testConnection() throws Exception{
// We create an empty config and add the ZK address. // We create an empty config and add the ZK address.
Configuration c = new Configuration(); Configuration c = new Configuration();
@ -1002,7 +1002,7 @@ public class TestHCM {
return prevNumRetriesVal; return prevNumRetriesVal;
} }
@Test (timeout=30000) @Test
public void testMulti() throws Exception { public void testMulti() throws Exception {
HTable table = TEST_UTIL.createMultiRegionTable(TABLE_NAME3, FAM_NAM); HTable table = TEST_UTIL.createMultiRegionTable(TABLE_NAME3, FAM_NAM);
try { try {
@ -1261,7 +1261,7 @@ public class TestHCM {
pool.shutdownNow(); pool.shutdownNow();
} }
@Test(timeout = 60000) @Test
public void testConnectionRideOverClusterRestart() throws IOException, InterruptedException { public void testConnectionRideOverClusterRestart() throws IOException, InterruptedException {
Configuration config = new Configuration(TEST_UTIL.getConfiguration()); Configuration config = new Configuration(TEST_UTIL.getConfiguration());
@ -1284,4 +1284,3 @@ public class TestHCM {
connection.close(); connection.close();
} }
} }

View File

@ -18,7 +18,10 @@
*/ */
package org.apache.hadoop.hbase.client; 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.io.IOException;
import static org.apache.hadoop.hbase.util.hbck.HbckTestingUtil.assertErrors; import static org.apache.hadoop.hbase.util.hbck.HbckTestingUtil.assertErrors;
@ -30,10 +33,13 @@ import java.util.Collection;
import java.util.List; import java.util.List;
import java.util.concurrent.ExecutorService; import java.util.concurrent.ExecutorService;
import javax.annotation.Nullable;
import org.apache.commons.logging.Log; import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory; import org.apache.commons.logging.LogFactory;
import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.hbase.Abortable; import org.apache.hadoop.hbase.Abortable;
import org.apache.hadoop.hbase.CategoryBasedTimeout;
import org.apache.hadoop.hbase.HBaseTestingUtility; import org.apache.hadoop.hbase.HBaseTestingUtility;
import org.apache.hadoop.hbase.HConstants; import org.apache.hadoop.hbase.HConstants;
import org.apache.hadoop.hbase.HRegionInfo; import org.apache.hadoop.hbase.HRegionInfo;
@ -46,7 +52,7 @@ import org.apache.hadoop.hbase.TableNotFoundException;
import org.apache.hadoop.hbase.Waiter; import org.apache.hadoop.hbase.Waiter;
import org.apache.hadoop.hbase.client.ConnectionManager.HConnectionImplementation; import org.apache.hadoop.hbase.client.ConnectionManager.HConnectionImplementation;
import org.apache.hadoop.hbase.regionserver.StorefileRefresherChore; 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.Bytes;
import org.apache.hadoop.hbase.util.HBaseFsck; import org.apache.hadoop.hbase.util.HBaseFsck;
import org.apache.hadoop.hbase.util.HBaseFsckRepair; import org.apache.hadoop.hbase.util.HBaseFsckRepair;
@ -57,14 +63,20 @@ import org.apache.hadoop.hbase.zookeeper.ZKUtil;
import org.apache.hadoop.hbase.zookeeper.ZooKeeperWatcher; import org.apache.hadoop.hbase.zookeeper.ZooKeeperWatcher;
import org.junit.After; import org.junit.After;
import org.junit.Before; import org.junit.Before;
import org.junit.Rule;
import org.junit.Test; import org.junit.Test;
import org.junit.experimental.categories.Category; import org.junit.experimental.categories.Category;
import org.junit.rules.TestRule;
/** /**
* Tests the scenarios where replicas are enabled for the meta table * Tests the scenarios where replicas are enabled for the meta table
*/ */
@Category(MediumTests.class) @Category(LargeTests.class)
public class TestMetaWithReplicas { 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 static final Log LOG = LogFactory.getLog(TestMetaWithReplicas.class);
private final HBaseTestingUtility TEST_UTIL = new HBaseTestingUtility(); private final HBaseTestingUtility TEST_UTIL = new HBaseTestingUtility();

View File

@ -25,15 +25,15 @@ import java.io.IOException;
import java.util.HashSet; import java.util.HashSet;
import java.util.Set; import java.util.Set;
import org.apache.commons.logging.Log; import org.apache.hadoop.conf.Configuration;
import org.apache.commons.logging.LogFactory;
import org.apache.hadoop.fs.Path; 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.HBaseTestingUtility;
import org.apache.hadoop.hbase.HColumnDescriptor; import org.apache.hadoop.hbase.HColumnDescriptor;
import org.apache.hadoop.hbase.HConstants; import org.apache.hadoop.hbase.HConstants;
import org.apache.hadoop.hbase.HTableDescriptor; import org.apache.hadoop.hbase.HTableDescriptor;
import org.apache.hadoop.hbase.testclassification.LargeTests; import org.apache.hadoop.hbase.testclassification.LargeTests;
import org.apache.hadoop.hbase.TableName;
import org.apache.hadoop.hbase.master.MasterFileSystem; import org.apache.hadoop.hbase.master.MasterFileSystem;
import org.apache.hadoop.hbase.master.snapshot.SnapshotManager; import org.apache.hadoop.hbase.master.snapshot.SnapshotManager;
import org.apache.hadoop.hbase.regionserver.NoSuchColumnFamilyException; import org.apache.hadoop.hbase.regionserver.NoSuchColumnFamilyException;
@ -45,15 +45,20 @@ import org.junit.After;
import org.junit.AfterClass; import org.junit.AfterClass;
import org.junit.Before; import org.junit.Before;
import org.junit.BeforeClass; import org.junit.BeforeClass;
import org.junit.Rule;
import org.junit.Test; import org.junit.Test;
import org.junit.experimental.categories.Category; import org.junit.experimental.categories.Category;
import org.junit.rules.TestRule;
/** /**
* Test restore snapshots from the client * Test restore snapshots from the client
*/ */
@Category(LargeTests.class) @Category(LargeTests.class)
public class TestRestoreSnapshotFromClient { 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();
private final static HBaseTestingUtility TEST_UTIL = new HBaseTestingUtility(); private final static HBaseTestingUtility TEST_UTIL = new HBaseTestingUtility();