deniskuzZ commented on code in PR #6652:
URL: https://github.com/apache/hive/pull/6652#discussion_r3735297099


##########
itests/hive-minikdc/src/test/java/org/apache/hive/minikdc/TestBeelineNativeInstallerCompatibility.java:
##########
@@ -0,0 +1,278 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.hive.minikdc;
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.InputStreamReader;
+import java.nio.charset.StandardCharsets;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.TimeUnit;
+
+import org.apache.hadoop.hive.conf.HiveConf;
+import org.apache.hive.jdbc.miniHS2.MiniHS2;
+import org.hadoop.hive.jdbc.SSLTestUtils;
+import org.junit.AfterClass;
+import org.junit.Assume;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+public class TestBeelineNativeInstallerCompatibility {
+
+  private static final long PROCESS_TIMEOUT_SECONDS = 60;
+
+  private static String beelineNativeBinary;
+  private static MiniHiveKdc miniHiveKdc;
+  private static MiniHS2 hs2Kerb;
+  private static MiniHS2 hs2Ssl;
+  private static String krb5ConfPath;
+  private static Path krb5CacheFilePath;
+
+  @BeforeClass
+  public static void beforeTest() throws Exception {
+    beelineNativeBinary = System.getProperty("beeline.native.binary");
+    Assume.assumeNotNull(beelineNativeBinary);
+    Path beelineBinaryPath = Paths.get(beelineNativeBinary);
+    Assume.assumeTrue(Files.isRegularFile(beelineBinaryPath));
+    Assume.assumeTrue(Files.isExecutable(beelineBinaryPath));
+
+    miniHiveKdc = new MiniHiveKdc();
+    krb5ConfPath = miniHiveKdc.miniKdc.getKrb5conf().getAbsolutePath();
+
+    Map<String, String> kerbConfOverlay = new HashMap<>();
+    kerbConfOverlay.put(HiveConf.ConfVars.HIVE_SERVER2_TRANSPORT_MODE.varname, 
MiniHS2.HS2_ALL_MODE);
+    
kerbConfOverlay.put(HiveConf.ConfVars.HIVE_SCHEDULED_QUERIES_EXECUTOR_ENABLED.varname,
 "false");
+    kerbConfOverlay.put(HiveConf.ConfVars.HIVE_QUERY_HISTORY_ENABLED.varname, 
"false");
+    // Avoid the ZooKeeper-backed lock manager (no ZK running in this test);
+    // otherwise every query hangs 30s trying to reach connectString ":2181".
+    kerbConfOverlay.put(HiveConf.ConfVars.HIVE_SUPPORT_CONCURRENCY.varname, 
"false");
+    hs2Kerb = MiniHiveKdc.getMiniHS2WithKerb(miniHiveKdc, new HiveConf());
+    hs2Kerb.start(kerbConfOverlay);
+
+    // Start a second HS2 instance with SSL enabled, but no Kerberos 
authentication.
+    // This is to test that beeline can connect to HS2 with SSL and TLS enabled
+    HiveConf sslHiveConf = new HiveConf();
+    sslHiveConf.set("hadoop.security.authentication", "simple");
+    sslHiveConf.setVar(HiveConf.ConfVars.HIVE_SERVER2_KERBEROS_PRINCIPAL,
+        
miniHiveKdc.getFullyQualifiedServicePrincipal(MiniHiveKdc.HIVE_SERVICE_PRINCIPAL));
+    sslHiveConf.setVar(HiveConf.ConfVars.HIVE_SERVER2_KERBEROS_KEYTAB,
+        
miniHiveKdc.getKeyTabFile(miniHiveKdc.getServicePrincipalForUser(MiniHiveKdc.HIVE_SERVICE_PRINCIPAL)));
+    Map<String, String> sslConfOverlay = new HashMap<>();
+    SSLTestUtils.setBinaryConfOverlay(sslConfOverlay);
+    SSLTestUtils.setSslConfOverlay(sslConfOverlay);
+    
sslConfOverlay.put(HiveConf.ConfVars.HIVE_SCHEDULED_QUERIES_EXECUTOR_ENABLED.varname,
 "false");
+    sslConfOverlay.put(HiveConf.ConfVars.HIVE_QUERY_HISTORY_ENABLED.varname, 
"false");
+    sslConfOverlay.put(HiveConf.ConfVars.HIVE_SUPPORT_CONCURRENCY.varname, 
"false");
+    hs2Ssl = new 
MiniHS2.Builder().withConf(sslHiveConf).withAuthenticationType("NONE").build();
+    hs2Ssl.start(sslConfOverlay);
+
+    Assume.assumeTrue(isCommandAvailable("kinit"));

Review Comment:
   are we using kerberized setup here?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to