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 2288742c10
commit 452e38ff80
3 changed files with 41 additions and 31 deletions

View File

@ -65,7 +65,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;
@ -85,7 +85,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())
@ -139,7 +139,7 @@ public class TestHCM {
TEST_UTIL.shutdownMiniCluster(); TEST_UTIL.shutdownMiniCluster();
} }
@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,
@ -203,7 +203,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();
@ -277,12 +277,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);
} }
@ -295,7 +295,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());
@ -413,7 +413,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();
@ -474,7 +474,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");
@ -572,7 +572,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());
@ -760,7 +760,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());
@ -779,7 +779,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{
Table table = TEST_UTIL.createMultiRegionTable(TABLE_NAME2, FAM_NAM); Table table = TEST_UTIL.createMultiRegionTable(TABLE_NAME2, FAM_NAM);
Put put = new Put(ROW); Put put = new Put(ROW);
@ -822,7 +822,7 @@ public class TestHCM {
table.close(); table.close();
} }
@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());
@ -850,7 +850,7 @@ public class TestHCM {
* Trivial test to verify that nobody messes with * Trivial test to verify that nobody messes with
* {@link ConnectionFactory#createConnection(Configuration)} * {@link ConnectionFactory#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);
@ -865,7 +865,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();
@ -892,7 +892,7 @@ public class TestHCM {
return prevNumRetriesVal; return prevNumRetriesVal;
} }
@Test (timeout=30000) @Test
public void testMulti() throws Exception { public void testMulti() throws Exception {
Table table = TEST_UTIL.createMultiRegionTable(TABLE_NAME3, FAM_NAM); Table table = TEST_UTIL.createMultiRegionTable(TABLE_NAME3, FAM_NAM);
try { try {
@ -1073,7 +1073,7 @@ public class TestHCM {
Math.abs(actual - expected) <= (0.01f * jitterBase)); Math.abs(actual - expected) <= (0.01f * jitterBase));
} }
@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());
@ -1096,4 +1096,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 java.util.Arrays; import java.util.Arrays;
@ -26,10 +29,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;
@ -41,7 +47,7 @@ import org.apache.hadoop.hbase.TableName;
import org.apache.hadoop.hbase.TableNotFoundException; import org.apache.hadoop.hbase.TableNotFoundException;
import org.apache.hadoop.hbase.Waiter; import org.apache.hadoop.hbase.Waiter;
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.HBaseFsck.ErrorReporter.ERROR_CODE; 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.apache.zookeeper.KeeperException;
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;
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;
/** /**
* 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,14 @@ 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.commons.logging.LogFactory;
import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.conf.Configuration;
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.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;
@ -47,15 +46,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, ClientTests.class}) @Category({LargeTests.class, ClientTests.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();
protected final static HBaseTestingUtility TEST_UTIL = new HBaseTestingUtility(); protected final static HBaseTestingUtility TEST_UTIL = new HBaseTestingUtility();