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 119a7cd60ed..a6d4d77e752 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 @@ -1035,6 +1035,11 @@ public class HBaseTestingUtility extends HBaseCommonTestingUtility { getHBaseAdmin(); // create immediately the hbaseAdmin LOG.info("Minicluster is up"); + + // Set the hbase.fs.tmp.dir config to make sure that we have some default value. This is + // for tests that do not read hbase-defaults.xml + setHBaseFsTmpDir(); + return (MiniHBaseCluster)this.hbaseCluster; } @@ -1196,6 +1201,17 @@ public class HBaseTestingUtility extends HBaseCommonTestingUtility { return createRootDir(false); } + + private void setHBaseFsTmpDir() throws IOException { + String hbaseFsTmpDirInString = this.conf.get("hbase.fs.tmp.dir"); + if (hbaseFsTmpDirInString == null) { + this.conf.set("hbase.fs.tmp.dir", getDataTestDirOnTestFS("hbase-staging").toString()); + LOG.info("Setting hbase.fs.tmp.dir to " + this.conf.get("hbase.fs.tmp.dir")); + } else { + LOG.info("The hbase.fs.tmp.dir is set to " + hbaseFsTmpDirInString); + } + } + /** * Flushes all caches in the mini hbase cluster * @throws IOException