SENTRY-2057: Set hadoop.tmp.dir to the maven build directory configured on java.io.tmpdir (Sergio Pena, no reviewed)
This patch allows the sentry tests to use the target/ directory of the maven build directory to be used as a temporary place for MR jobs. This helps on the current test issues found on Jenkins where the /tmp is cleaned up after sometime for an unknown reason. Project: http://git-wip-us.apache.org/repos/asf/sentry/repo Commit: http://git-wip-us.apache.org/repos/asf/sentry/commit/a3559799 Tree: http://git-wip-us.apache.org/repos/asf/sentry/tree/a3559799 Diff: http://git-wip-us.apache.org/repos/asf/sentry/diff/a3559799 Branch: refs/heads/akolb-cli Commit: a355979914bd50cfb68fe9f45dcf471a33e5f9c4 Parents: 0b487f3 Author: Sergio Pena <[email protected]> Authored: Sun Nov 19 08:43:13 2017 -0600 Committer: Sergio Pena <[email protected]> Committed: Sun Nov 19 08:43:13 2017 -0600 ---------------------------------------------------------------------- .../apache/sentry/tests/e2e/hdfs/TestHDFSIntegrationBase.java | 5 +++++ .../sentry/tests/e2e/hive/hiveserver/HiveServerFactory.java | 5 +++++ 2 files changed, 10 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/sentry/blob/a3559799/sentry-tests/sentry-tests-hive/src/test/java/org/apache/sentry/tests/e2e/hdfs/TestHDFSIntegrationBase.java ---------------------------------------------------------------------- diff --git a/sentry-tests/sentry-tests-hive/src/test/java/org/apache/sentry/tests/e2e/hdfs/TestHDFSIntegrationBase.java b/sentry-tests/sentry-tests-hive/src/test/java/org/apache/sentry/tests/e2e/hdfs/TestHDFSIntegrationBase.java index 3c8b70e..7495fc7 100644 --- a/sentry-tests/sentry-tests-hive/src/test/java/org/apache/sentry/tests/e2e/hdfs/TestHDFSIntegrationBase.java +++ b/sentry-tests/sentry-tests-hive/src/test/java/org/apache/sentry/tests/e2e/hdfs/TestHDFSIntegrationBase.java @@ -570,6 +570,11 @@ public abstract class TestHDFSIntegrationBase { hiveConf.set(ConfVars.METASTORE_DISALLOW_INCOMPATIBLE_COL_TYPE_CHANGES.varname, "false"); hiveConf.set(ConfVars.HIVE_IN_TEST.varname, "true"); + // Sets the hadoop temporary directory specified by the java.io.tmpdir (already set to the + // maven build directory to avoid writing to the /tmp directly + String hadoopTempDir = System.getProperty("java.io.tmpdir") + File.separator + "hadoop-tmp"; + hiveConf.set("hadoop.tmp.dir", hadoopTempDir); + // Sets hive.metastore.authorization.storage.checks to true, so that // disallow the operations such as drop-partition if the user in question // doesn't have permissions to delete the corresponding directory http://git-wip-us.apache.org/repos/asf/sentry/blob/a3559799/sentry-tests/sentry-tests-hive/src/test/java/org/apache/sentry/tests/e2e/hive/hiveserver/HiveServerFactory.java ---------------------------------------------------------------------- diff --git a/sentry-tests/sentry-tests-hive/src/test/java/org/apache/sentry/tests/e2e/hive/hiveserver/HiveServerFactory.java b/sentry-tests/sentry-tests-hive/src/test/java/org/apache/sentry/tests/e2e/hive/hiveserver/HiveServerFactory.java index 64c6394..d5eb137 100644 --- a/sentry-tests/sentry-tests-hive/src/test/java/org/apache/sentry/tests/e2e/hive/hiveserver/HiveServerFactory.java +++ b/sentry-tests/sentry-tests-hive/src/test/java/org/apache/sentry/tests/e2e/hive/hiveserver/HiveServerFactory.java @@ -201,6 +201,11 @@ public class HiveServerFactory { // to HIVESERVER2 if we're using the authorization V2 in test mode. properties.put(ConfVars.HIVE_TEST_AUTHORIZATION_SQLSTD_HS2_MODE.varname, "true"); + // Sets the hadoop temporary directory specified by the java.io.tmpdir (already set to the + // maven build directory to avoid writing to the /tmp directly + String hadoopTempDir = System.getProperty("java.io.tmpdir") + File.separator + "hadoop-tmp"; + properties.put("hadoop.tmp.dir", hadoopTempDir); + if (!properties.containsKey(METASTORE_BYPASS)) { properties.put(METASTORE_BYPASS, "hive,impala," + System.getProperty("user.name", "")); } else {
