SENTRY-806: Fix unit test failure: TestMetastoreEndToEnd.testPartionInsert - java.lang.RuntimeException: Cannot make directory (Anne Yu via Lenni Kuff)
Project: http://git-wip-us.apache.org/repos/asf/incubator-sentry/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-sentry/commit/09d1a927 Tree: http://git-wip-us.apache.org/repos/asf/incubator-sentry/tree/09d1a927 Diff: http://git-wip-us.apache.org/repos/asf/incubator-sentry/diff/09d1a927 Branch: refs/heads/hive_plugin_v2 Commit: 09d1a927939b5d69539726d81001507ee6d4f701 Parents: 806953c Author: Lenni Kuff <[email protected]> Authored: Thu Jul 23 12:54:57 2015 -0700 Committer: Lenni Kuff <[email protected]> Committed: Thu Jul 23 12:54:57 2015 -0700 ---------------------------------------------------------------------- .../tests/e2e/hive/AbstractTestWithStaticConfiguration.java | 9 +++++++++ 1 file changed, 9 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-sentry/blob/09d1a927/sentry-tests/sentry-tests-hive/src/test/java/org/apache/sentry/tests/e2e/hive/AbstractTestWithStaticConfiguration.java ---------------------------------------------------------------------- diff --git a/sentry-tests/sentry-tests-hive/src/test/java/org/apache/sentry/tests/e2e/hive/AbstractTestWithStaticConfiguration.java b/sentry-tests/sentry-tests-hive/src/test/java/org/apache/sentry/tests/e2e/hive/AbstractTestWithStaticConfiguration.java index e6c1e89..2a1c9f0 100644 --- a/sentry-tests/sentry-tests-hive/src/test/java/org/apache/sentry/tests/e2e/hive/AbstractTestWithStaticConfiguration.java +++ b/sentry-tests/sentry-tests-hive/src/test/java/org/apache/sentry/tests/e2e/hive/AbstractTestWithStaticConfiguration.java @@ -39,6 +39,9 @@ import junit.framework.Assert; import org.apache.commons.io.FileUtils; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.fs.FileSystem; +import org.apache.hadoop.fs.Path; +import org.apache.hadoop.fs.permission.FsAction; +import org.apache.hadoop.fs.permission.FsPermission; import org.apache.hadoop.hive.conf.HiveConf; import org.apache.hadoop.hive.conf.HiveConf.ConfVars; import org.apache.sentry.binding.hive.SentryHiveAuthorizationTaskFactoryImpl; @@ -243,6 +246,12 @@ public abstract class AbstractTestWithStaticConfiguration { hiveServer = create(properties, baseDir, confDir, logDir, policyURI, fileSystem); hiveServer.start(); createContext(); + + // Create tmp as scratch dir if it doesn't exist + Path tmpPath = new Path("/tmp"); + if (!fileSystem.exists(tmpPath)) { + fileSystem.mkdirs(tmpPath, new FsPermission(FsAction.ALL, FsAction.ALL, FsAction.ALL)); + } } public static HiveServer create(Map<String, String> properties,
