From 860c326adddebab73b6bfa1d25e28ba05557e51f Mon Sep 17 00:00:00 2001 From: chenheng Date: Sat, 12 Dec 2015 11:28:14 +0800 Subject: [PATCH] HBASE-14915 Hanging test : org.apache.hadoop.hbase.mapreduce.TestImportExport --- .../org/apache/hadoop/hbase/HBaseTestingUtility.java | 3 +++ .../hadoop/hbase/mapreduce/TestImportExport.java | 18 ++++++++++++------ 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/HBaseTestingUtility.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/HBaseTestingUtility.java index 6a7650a..66ba047 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/HBaseTestingUtility.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/HBaseTestingUtility.java @@ -597,6 +597,9 @@ public class HBaseTestingUtility extends HBaseCommonTestingUtility { } FileSystem fs = this.dfsCluster.getFileSystem(); FSUtils.setFsDefault(this.conf, new Path(fs.getUri())); + if (this.conf.getBoolean("hbase.test.local.fileSystem", false)) { + FSUtils.setFsDefault(this.conf, new Path("file:///")); + } } public MiniDFSCluster startMiniDFSCluster(int servers, final String racks[], String hosts[]) diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/mapreduce/TestImportExport.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/mapreduce/TestImportExport.java index 2faac62..616110c 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/mapreduce/TestImportExport.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/mapreduce/TestImportExport.java @@ -42,6 +42,7 @@ import org.apache.hadoop.fs.FileSystem; import org.apache.hadoop.fs.Path; import org.apache.hadoop.hbase.Cell; import org.apache.hadoop.hbase.CellUtil; +import org.apache.hadoop.hbase.CategoryBasedTimeout; import org.apache.hadoop.hbase.HBaseTestingUtility; import org.apache.hadoop.hbase.HColumnDescriptor; import org.apache.hadoop.hbase.HConstants; @@ -64,7 +65,7 @@ import org.apache.hadoop.hbase.io.ImmutableBytesWritable; import org.apache.hadoop.hbase.mapreduce.Import.KeyValueImporter; import org.apache.hadoop.hbase.regionserver.wal.WALActionsListener; import org.apache.hadoop.hbase.regionserver.wal.WALEdit; -import org.apache.hadoop.hbase.testclassification.LargeTests; +import org.apache.hadoop.hbase.testclassification.MediumTests; import org.apache.hadoop.hbase.util.Bytes; import org.apache.hadoop.hbase.util.LauncherSecurityManager; import org.apache.hadoop.hbase.wal.WAL; @@ -77,15 +78,17 @@ import org.junit.AfterClass; import org.junit.Assert; 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; import org.mockito.invocation.InvocationOnMock; import org.mockito.stubbing.Answer; /** * Tests the table import and table export MR job functionality */ -@Category(LargeTests.class) +@Category(MediumTests.class) public class TestImportExport { private static final Log LOG = LogFactory.getLog(TestImportExport.class); private static final HBaseTestingUtility UTIL = new HBaseTestingUtility(); @@ -102,19 +105,22 @@ public class TestImportExport { private static long now = System.currentTimeMillis(); + @Rule + public final TestRule timeout = CategoryBasedTimeout.builder().withTimeout(this.getClass()). + withLookingForStuckThread(true).build(); + @BeforeClass public static void beforeClass() throws Exception { // Up the handlers; this test needs more than usual. + UTIL.getConfiguration().setBoolean("hbase.test.local.fileSystem", true); UTIL.getConfiguration().setInt(HConstants.REGION_SERVER_HIGH_PRIORITY_HANDLER_COUNT, 10); UTIL.startMiniCluster(); - UTIL.startMiniMapReduceCluster(); FQ_OUTPUT_DIR = new Path(OUTPUT_DIR).makeQualified(FileSystem.get(UTIL.getConfiguration())).toString(); } @AfterClass public static void afterClass() throws Exception { - UTIL.shutdownMiniMapReduceCluster(); UTIL.shutdownMiniCluster(); } @@ -363,7 +369,7 @@ public class TestImportExport { Table exportT = UTIL.getConnection().getTable(desc.getTableName()); //Add first version of QUAL Put p = new Put(ROW1); - p.add(FAMILYA, QUAL, now, QUAL); + p.add(FAMILYA, QUAL, now, QUAL); exportT.put(p); //Add Delete family marker @@ -372,7 +378,7 @@ public class TestImportExport { //Add second version of QUAL p = new Put(ROW1); - p.add(FAMILYA, QUAL, now+5, "s".getBytes()); + p.add(FAMILYA, QUAL, now + 5, "s".getBytes()); exportT.put(p); //Add second Delete family marker -- 2.5.4 (Apple Git-61)