diff --git a/hbase-common/src/test/java/org/apache/hadoop/hbase/HBaseCommonTestingUtility.java b/hbase-common/src/test/java/org/apache/hadoop/hbase/HBaseCommonTestingUtility.java index 3cae4d2fb7f..0bf8aea1331 100644 --- a/hbase-common/src/test/java/org/apache/hadoop/hbase/HBaseCommonTestingUtility.java +++ b/hbase-common/src/test/java/org/apache/hadoop/hbase/HBaseCommonTestingUtility.java @@ -108,10 +108,7 @@ public class HBaseCommonTestingUtility { dataTestDir.getAbsolutePath()); return null; } - - String randomStr = UUID.randomUUID().toString(); - Path testPath = new Path(getBaseTestDir(), randomStr); - + Path testPath = getRandomDir(); this.dataTestDir = new File(testPath.toString()).getAbsoluteFile(); // Set this property so if mapreduce jobs run, they will use this as their home dir. System.setProperty("test.build.dir", this.dataTestDir.toString()); @@ -122,6 +119,14 @@ public class HBaseCommonTestingUtility { return testPath; } + /** + * @return A dir with a random (uuid) name under the test dir + * @see #getBaseTestDir() + */ + public Path getRandomDir() { + return new Path(getBaseTestDir(), UUID.randomUUID().toString()); + } + protected void createSubDir(String propertyName, Path parent, String subDirName) { Path newPath = new Path(parent, subDirName); File newDir = new File(newPath.toString()).getAbsoluteFile(); diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/mapreduce/TestMultiTableSnapshotInputFormat.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/mapreduce/TestMultiTableSnapshotInputFormat.java index c7621808713..41e67808ce5 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/mapreduce/TestMultiTableSnapshotInputFormat.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/mapreduce/TestMultiTableSnapshotInputFormat.java @@ -64,8 +64,7 @@ public class TestMultiTableSnapshotInputFormat extends MultiTableInputFormatTest @Before public void setUp() throws Exception { - this.restoreDir = TEST_UTIL.getDataTestDir(); - + this.restoreDir = TEST_UTIL.getRandomDir(); } @Override