Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(wip)(test)Adding Kerberos DNS check to the Hive connection case #41361

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions fe/fe-core/src/main/java/org/apache/doris/DorisFE.java
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ public class DorisFE {
private static FileLock processFileLock;

public static void main(String[] args) {
System.setProperty("sun.security.krb5.debug", "true");
// Every doris version should have a final meta version, it should not change
// between small releases. Add a check here to avoid mistake.
if (Version.DORIS_FE_META_VERSION > 0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,14 @@
// under the License.

suite("test_single_hive_kerberos", "p0,external,kerberos,external_docker,external_docker_kerberos") {
def command = "sudo docker ps"
def process = command.execute()
process.waitFor()

def output = process.in.text

println "Docker containers:"
println output
String enabled = context.config.otherConfigs.get("enableKerberosTest")
if (enabled != null && enabled.equalsIgnoreCase("true")) {
String hms_catalog_name = "test_single_hive_kerberos"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,28 +18,21 @@ import groovyjarjarantlr4.v4.codegen.model.ExceptionClause
// under the License.

import org.junit.Assert;

import java.net.Socket
suite("test_two_hive_kerberos", "p0,external,kerberos,external_docker,external_docker_kerberos") {
def command = "sudo docker ps"
def process = command.execute()
process.waitFor()

def output = process.in.text

println "Docker containers:"
println output
String enabled = context.config.otherConfigs.get("enableKerberosTest")
if (enabled != null && enabled.equalsIgnoreCase("true")) {
String hms_catalog_name = "test_two_hive_kerberos"
sql """drop catalog if exists ${hms_catalog_name};"""
sql """
CREATE CATALOG IF NOT EXISTS ${hms_catalog_name}
PROPERTIES (
"type" = "hms",
"hive.metastore.uris" = "thrift://172.31.71.25:9083",
"fs.defaultFS" = "hdfs://172.31.71.25:8020",
"hadoop.kerberos.min.seconds.before.relogin" = "5",
"hadoop.security.authentication" = "kerberos",
"hadoop.kerberos.principal"="hive/presto-master.docker.cluster@LABS.TERADATA.COM",
"hadoop.kerberos.keytab" = "/keytabs/hive-presto-master.keytab",
"hive.metastore.sasl.enabled " = "true",
"hive.metastore.kerberos.principal" = "hive/_HOST@LABS.TERADATA.COM"
);
"""

sql """drop catalog if exists other_${hms_catalog_name};"""

sql """
CREATE CATALOG IF NOT EXISTS other_${hms_catalog_name}
PROPERTIES (
Expand All @@ -57,21 +50,42 @@ suite("test_two_hive_kerberos", "p0,external,kerberos,external_docker,external_d
DEFAULT"
);
"""
sql """drop catalog if exists ${hms_catalog_name};"""
sql """
CREATE CATALOG IF NOT EXISTS ${hms_catalog_name}
PROPERTIES (
"type" = "hms",
"hive.metastore.uris" = "thrift://172.31.71.25:9083",
"fs.defaultFS" = "hdfs://172.31.71.25:8020",
"hadoop.kerberos.min.seconds.before.relogin" = "5",
"hadoop.security.authentication" = "kerberos",
"hadoop.kerberos.principal"="hive/presto-master.docker.cluster@LABS.TERADATA.COM",
"hadoop.kerberos.keytab" = "/keytabs/hive-presto-master.keytab",
"hive.metastore.sasl.enabled " = "true",
"hive.metastore.kerberos.principal" = "hive/_HOST@LABS.TERADATA.COM",
"hadoop.security.auth_to_local" = "RULE:[2:\$1@\$0](.*@LABS.TERADATA.COM)s/@.*//
RULE:[2:\$1@\$0](.*@OTHERLABS.TERADATA.COM)s/@.*//
RULE:[2:\$1@\$0](.*@OTHERREALM.COM)s/@.*//
DEFAULT",
);
"""

// 1. catalogA
sql """switch ${hms_catalog_name};"""
logger.info("switched to catalog " + hms_catalog_name)
sql """ show databases """
sql """ use test_krb_hive_db """
order_qt_q01 """ select * from test_krb_hive_db.test_krb_hive_tbl """




// 2. catalogB
sql """switch other_${hms_catalog_name};"""
logger.info("switched to other catalog " + hms_catalog_name)
sql """ show databases """
sql """ use test_krb_hive_db """
order_qt_q02 """ select * from test_krb_hive_db.test_krb_hive_tbl """

// 1. catalogA
sql """switch ${hms_catalog_name};"""
logger.info("switched to catalog " + hms_catalog_name)
sql """ show databases """
sql """ use test_krb_hive_db """
order_qt_q01 """ select * from test_krb_hive_db.test_krb_hive_tbl """
// 3. write back test case
sql """ switch ${hms_catalog_name}; """
sql """ CREATE DATABASE IF NOT EXISTS `test_krb_hms_db`; """
Expand Down
Loading