From e9c4f12856420b3089665751ea141298580f6c21 Mon Sep 17 00:00:00 2001 From: chenheng Date: Thu, 24 Mar 2016 15:19:02 +0800 Subject: [PATCH] HBASE-15384 Avoid using '/tmp' directory in TestBulkLoad --- .../hadoop/hbase/regionserver/TestBulkLoad.java | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestBulkLoad.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestBulkLoad.java index d0633a843bc..6ba12a935ce 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestBulkLoad.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestBulkLoad.java @@ -38,6 +38,7 @@ import org.apache.hadoop.fs.Path; import org.apache.hadoop.hbase.CellUtil; import org.apache.hadoop.hbase.DoNotRetryIOException; import org.apache.hadoop.hbase.HBaseConfiguration; +import org.apache.hadoop.hbase.HBaseTestingUtility; import org.apache.hadoop.hbase.HColumnDescriptor; import org.apache.hadoop.hbase.HRegionInfo; import org.apache.hadoop.hbase.HTableDescriptor; @@ -81,6 +82,7 @@ public class TestBulkLoad { @ClassRule public static TemporaryFolder testFolder = new TemporaryFolder(); + private static HBaseTestingUtility TEST_UTIL = new HBaseTestingUtility(); private final WAL log = mock(WAL.class); private final Configuration conf = HBaseConfiguration.create(); private final Random random = new Random(); @@ -217,13 +219,18 @@ public class TestBulkLoad { } private Pair withMissingHFileForFamily(byte[] family) { - return new Pair(family, "/tmp/does_not_exist"); + return new Pair(family, getNotExistFilePath()); + } + + private String getNotExistFilePath() { + Path path = new Path(TEST_UTIL.getDataTestDir(), "does_not_exist"); + return path.toUri().getPath(); } private Pair withInvalidColumnFamilyButProperHFileLocation(byte[] family) throws IOException { createHFileForFamilies(family); - return new Pair(new byte[]{0x00, 0x01, 0x02}, "/tmp/does_not_exist"); + return new Pair(new byte[]{0x00, 0x01, 0x02}, getNotExistFilePath()); }