You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hive.apache.org by se...@apache.org on 2018/02/28 19:23:20 UTC

[2/3] hive git commit: HIVE-18796 : fix TestSSL (Sergey Shelukhin, reviewed by Zoltan Haindrich)

HIVE-18796 : fix TestSSL (Sergey Shelukhin, reviewed by Zoltan Haindrich)


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

Branch: refs/heads/master
Commit: 5106df059f40c471b91bc969832001218171cdee
Parents: 5393e9f
Author: sergey <se...@apache.org>
Authored: Wed Feb 28 11:13:43 2018 -0800
Committer: sergey <se...@apache.org>
Committed: Wed Feb 28 11:13:43 2018 -0800

----------------------------------------------------------------------
 common/src/java/org/apache/hadoop/hive/conf/HiveConf.java    | 1 +
 .../src/main/java/org/hadoop/hive/jdbc/SSLTestUtils.java     | 2 ++
 .../src/java/org/apache/hive/service/server/HiveServer2.java | 8 ++++++--
 3 files changed, 9 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hive/blob/5106df05/common/src/java/org/apache/hadoop/hive/conf/HiveConf.java
----------------------------------------------------------------------
diff --git a/common/src/java/org/apache/hadoop/hive/conf/HiveConf.java b/common/src/java/org/apache/hadoop/hive/conf/HiveConf.java
index 0880a96..1e322b8 100644
--- a/common/src/java/org/apache/hadoop/hive/conf/HiveConf.java
+++ b/common/src/java/org/apache/hadoop/hive/conf/HiveConf.java
@@ -574,6 +574,7 @@ public class HiveConf extends Configuration {
         "If not set, defaults to the codec extension for text files (e.g. \".gz\"), or no extension otherwise."),
 
     HIVE_IN_TEST("hive.in.test", false, "internal usage only, true in test mode", true),
+    HIVE_IN_TEST_SSL("hive.in.ssl.test", false, "internal usage only, true in SSL test mode", true),
     HIVE_IN_TEST_IDE("hive.in.ide.test", false, "internal usage only, true if test running in ide",
         true),
     HIVE_TESTING_SHORT_LOGS("hive.testing.short.logs", false,

http://git-wip-us.apache.org/repos/asf/hive/blob/5106df05/itests/hive-unit/src/main/java/org/hadoop/hive/jdbc/SSLTestUtils.java
----------------------------------------------------------------------
diff --git a/itests/hive-unit/src/main/java/org/hadoop/hive/jdbc/SSLTestUtils.java b/itests/hive-unit/src/main/java/org/hadoop/hive/jdbc/SSLTestUtils.java
index 986ccd6..78a23a2 100644
--- a/itests/hive-unit/src/main/java/org/hadoop/hive/jdbc/SSLTestUtils.java
+++ b/itests/hive-unit/src/main/java/org/hadoop/hive/jdbc/SSLTestUtils.java
@@ -74,12 +74,14 @@ public class SSLTestUtils {
     confOverlay.put(HiveConf.ConfVars.HIVE_SERVER2_TRANSPORT_MODE.varname, HS2_HTTP_MODE);
     confOverlay.put(HiveConf.ConfVars.HIVE_SERVER2_THRIFT_HTTP_PATH.varname, HS2_HTTP_ENDPOINT);
     confOverlay.put(HiveConf.ConfVars.HIVE_SERVER2_ENABLE_DOAS.varname, "true");
+    confOverlay.put(HiveConf.ConfVars.HIVE_IN_TEST_SSL.varname, "true");
   }
 
   public static void setBinaryConfOverlay(Map<String, String> confOverlay) {
     confOverlay.put(HiveConf.ConfVars.HIVE_SERVER2_TRANSPORT_MODE.varname, HS2_BINARY_MODE);
     confOverlay.put(HiveConf.ConfVars.HIVE_SERVER2_AUTHENTICATION.varname, HS2_BINARY_AUTH_MODE);
     confOverlay.put(HiveConf.ConfVars.HIVE_SERVER2_ENABLE_DOAS.varname, "true");
+    confOverlay.put(HiveConf.ConfVars.HIVE_IN_TEST_SSL.varname, "true");
   }
 
   public static void setupTestTableWithData(String tableName, Path dataFilePath,

http://git-wip-us.apache.org/repos/asf/hive/blob/5106df05/service/src/java/org/apache/hive/service/server/HiveServer2.java
----------------------------------------------------------------------
diff --git a/service/src/java/org/apache/hive/service/server/HiveServer2.java b/service/src/java/org/apache/hive/service/server/HiveServer2.java
index 6c1a0b9..86c9c2b 100644
--- a/service/src/java/org/apache/hive/service/server/HiveServer2.java
+++ b/service/src/java/org/apache/hive/service/server/HiveServer2.java
@@ -305,8 +305,12 @@ public class HiveServer2 extends CompositeService {
     WMFullResourcePlan resourcePlan;
     try {
       resourcePlan = sessionHive.getActiveResourcePlan();
-    } catch (HiveException e) {
-      throw new RuntimeException(e);
+    } catch (Throwable e) {
+      if (!HiveConf.getBoolVar(hiveConf, ConfVars.HIVE_IN_TEST_SSL)) {
+        throw new RuntimeException(e);
+      } else {
+        resourcePlan = null; // Ignore errors in SSL tests where the connection is misconfigured.
+      }
     }
     if (hasQueue && resourcePlan == null
         && HiveConf.getBoolVar(hiveConf, ConfVars.HIVE_IN_TEST)) {