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 4619ef2..e3c2c2c 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 @@ -450,22 +450,27 @@ public class HBaseTestingUtility extends HBaseCommonTestingUtility { + dataTestDirOnTestFS.toString()); return; } - + dataTestDirOnTestFS = setupNewDataTestDirOnTestFS(); + } + + private Path setupNewDataTestDirOnTestFS() throws IOException { //The file system can be either local, mini dfs, or if the configuration //is supplied externally, it can be an external cluster FS. If it is a local //file system, the tests should use getBaseTestDir, otherwise, we can use //the working directory, and create a unique sub dir there FileSystem fs = getTestFileSystem(); + Path newDataTestDir = null; if (fs.getUri().getScheme().equals(FileSystem.getLocal(conf).getUri().getScheme())) { File dataTestDir = new File(getDataTestDir().toString()); if (deleteOnExit()) dataTestDir.deleteOnExit(); - dataTestDirOnTestFS = new Path(dataTestDir.getAbsolutePath()); + newDataTestDir = new Path(dataTestDir.getAbsolutePath()); } else { Path base = getBaseTestDirOnTestFS(); String randomStr = UUID.randomUUID().toString(); - dataTestDirOnTestFS = new Path(base, randomStr); - if (deleteOnExit()) fs.deleteOnExit(dataTestDirOnTestFS); + newDataTestDir = new Path(base, randomStr); + if (deleteOnExit()) fs.deleteOnExit(newDataTestDir); } + return newDataTestDir; } /** @@ -1032,8 +1037,7 @@ public class HBaseTestingUtility extends HBaseCommonTestingUtility { * @throws IOException */ public Path getDefaultRootDirPath() throws IOException { - FileSystem fs = FileSystem.get(this.conf); - return new Path(fs.makeQualified(fs.getHomeDirectory()),"hbase"); + return setupNewDataTestDirOnTestFS(); } /**