hive-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aihu...@apache.org
Subject hive git commit: HIVE-16468: BeeLineDriver should be able to run tests against an externally created cluster (Peter Vary, reviewed by Vihang Karajgaonkar and Aihua Xu)
Date Fri, 19 May 2017 15:47:52 GMT
Repository: hive
Updated Branches:
  refs/heads/master 3be1eedb1 -> 4045ca399


HIVE-16468: BeeLineDriver should be able to run tests against an externally created cluster
(Peter Vary, reviewed by Vihang Karajgaonkar and Aihua Xu)


Project: http://git-wip-us.apache.org/repos/asf/hive/repo
Commit: http://git-wip-us.apache.org/repos/asf/hive/commit/4045ca39
Tree: http://git-wip-us.apache.org/repos/asf/hive/tree/4045ca39
Diff: http://git-wip-us.apache.org/repos/asf/hive/diff/4045ca39

Branch: refs/heads/master
Commit: 4045ca399228a8cac8005131cacee95568e6999a
Parents: 3be1eed
Author: Aihua Xu <aihuaxu@apache.org>
Authored: Fri May 19 11:42:28 2017 -0400
Committer: Aihua Xu <aihuaxu@apache.org>
Committed: Fri May 19 11:47:20 2017 -0400

----------------------------------------------------------------------
 .../hive/cli/control/CoreBeeLineDriver.java     | 58 ++++++++++++--------
 1 file changed, 34 insertions(+), 24 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hive/blob/4045ca39/itests/util/src/main/java/org/apache/hadoop/hive/cli/control/CoreBeeLineDriver.java
----------------------------------------------------------------------
diff --git a/itests/util/src/main/java/org/apache/hadoop/hive/cli/control/CoreBeeLineDriver.java
b/itests/util/src/main/java/org/apache/hadoop/hive/cli/control/CoreBeeLineDriver.java
index 2be83ca..9dfc253 100644
--- a/itests/util/src/main/java/org/apache/hadoop/hive/cli/control/CoreBeeLineDriver.java
+++ b/itests/util/src/main/java/org/apache/hadoop/hive/cli/control/CoreBeeLineDriver.java
@@ -20,7 +20,9 @@ package org.apache.hadoop.hive.cli.control;
 import static org.junit.Assert.fail;
 
 import com.google.common.base.Strings;
+import org.apache.commons.lang.StringUtils;
 import org.apache.hadoop.hive.conf.HiveConf;
+import org.apache.hadoop.hive.conf.HiveConfUtil;
 import org.apache.hadoop.hive.ql.QTestProcessExecResult;
 import org.apache.hadoop.hive.ql.hooks.PreExecutePrinter;
 import org.apache.hive.beeline.ConvertedOutputFile.Converter;
@@ -52,19 +54,40 @@ public class CoreBeeLineDriver extends CliAdapter {
   private QFileClientBuilder clientBuilder;
   private QFileBuilder fileBuilder;
 
-//  private static QTestUtil.QTestSetup miniZKCluster = null;
-
   public CoreBeeLineDriver(AbstractCliConfig testCliConfig) {
     super(testCliConfig);
     queryDirectory = new File(testCliConfig.getQueryDirectory());
     logDirectory = new File(testCliConfig.getLogDir());
     resultsDirectory = new File(testCliConfig.getResultsDir());
-    testDataDirectory = new File(hiveRootDirectory, "data" + File.separator + "files");
+    String testDataDirectoryName = System.getProperty("test.data.dir");
+    if (testDataDirectoryName == null) {
+      testDataDirectory = new File(hiveRootDirectory, "data" + File.separator + "files");
+    } else {
+      testDataDirectory = new File(testDataDirectoryName);
+    }
     testScriptDirectory = new File(hiveRootDirectory, "data" + File.separator + "scripts");
     initScript = new File(testScriptDirectory, testCliConfig.getInitScript());
     cleanupScript = new File(testScriptDirectory, testCliConfig.getCleanupScript());
   }
 
+  private static MiniHS2 createMiniServer() throws Exception {
+    HiveConf hiveConf = new HiveConf();
+    // We do not need Zookeeper at the moment
+    hiveConf.set(HiveConf.ConfVars.HIVE_LOCK_MANAGER.varname,
+        "org.apache.hadoop.hive.ql.lockmgr.EmbeddedLockManager");
+
+    MiniHS2 miniHS2 = new MiniHS2.Builder()
+        .withConf(hiveConf)
+        .cleanupLocalDirOnStartup(true)
+        .build();
+
+    miniHS2.start(new HashMap<String, String>());
+
+    System.err.println(HiveConfUtil.dumpConfig(miniHS2.getHiveConf()));
+
+    return miniHS2;
+  }
+
   @Override
   @BeforeClass
   public void beforeClass() throws Exception {
@@ -77,27 +100,17 @@ public class CoreBeeLineDriver extends CliAdapter {
       rewriteSourceTables = false;
     }
 
-    HiveConf hiveConf = new HiveConf();
-    // We do not need Zookeeper at the moment
-    hiveConf.set(HiveConf.ConfVars.HIVE_LOCK_MANAGER.varname,
-        "org.apache.hadoop.hive.ql.lockmgr.EmbeddedLockManager");
-
-    // But if we need later we can enable it with this, or create one ourself
-//    miniZKCluster = new QTestUtil.QTestSetup();
-//    miniZKCluster.preTest(hiveConf);
-
-    hiveConf.logVars(System.err);
-    System.err.flush();
-
-    miniHS2 = new MiniHS2.Builder().withConf(hiveConf).cleanupLocalDirOnStartup(true).build();
-
-    miniHS2.start(new HashMap<String, String>());
+    String beeLineUrl = System.getProperty("test.beeline.url");
+    if (StringUtils.isEmpty(beeLineUrl)) {
+      miniHS2 = createMiniServer();
+      beeLineUrl = miniHS2.getJdbcURL();
+    }
 
     clientBuilder = new QFileClientBuilder()
         .setJdbcDriver("org.apache.hive.jdbc.HiveDriver")
-        .setJdbcUrl(miniHS2.getJdbcURL())
-        .setUsername("user")
-        .setPassword("password");
+        .setJdbcUrl(beeLineUrl)
+        .setUsername(System.getProperty("test.beeline.user", "user"))
+        .setPassword(System.getProperty("test.beeline.password", "password"));
 
     fileBuilder = new QFileBuilder()
         .setLogDirectory(logDirectory)
@@ -135,9 +148,6 @@ public class CoreBeeLineDriver extends CliAdapter {
     if (miniHS2 != null) {
       miniHS2.stop();
     }
-    //    if (miniZKCluster != null) {
-    //      miniZKCluster.tearDown();
-    //    }
   }
 
   public void runTest(QFile qFile) throws Exception {


Mime
View raw message