From f49f2961815798a957c427503c16dc2b9c34c666 Mon Sep 17 00:00:00 2001 From: Enis Soztutar Date: Wed, 10 Jun 2015 16:30:02 -0700 Subject: [PATCH] HBASE-13878 Set hbase.fs.tmp.dir config in HBaseTestingUtility.java for Phoenix UT to use --- .../apache/hadoop/hbase/HBaseTestingUtility.java | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) 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 bebafc86242..f6fdff61310 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 @@ -1023,6 +1023,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; } @@ -1178,6 +1183,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