diff --git a/kyuubi-server/src/test/scala/yaooqinn/kyuubi/auth/AuthenticationProviderFactorySuite.scala b/kyuubi-server/src/test/scala/yaooqinn/kyuubi/auth/AuthenticationProviderFactorySuite.scala index 197df02e6..fae185b38 100644 --- a/kyuubi-server/src/test/scala/yaooqinn/kyuubi/auth/AuthenticationProviderFactorySuite.scala +++ b/kyuubi-server/src/test/scala/yaooqinn/kyuubi/auth/AuthenticationProviderFactorySuite.scala @@ -31,6 +31,10 @@ class AuthenticationProviderFactorySuite extends SparkFunSuite { val ldap = AuthenticationProviderFactory.getAuthenticationProvider(AuthMethods.LDAP, conf) val exception = intercept[AuthenticationException](ldap.authenticate("test", "test")) assert(exception.getMessage.contains("Error validating LDAP user:")) + + val e2 = intercept[AuthenticationException]( + AuthenticationProviderFactory.getAuthenticationProvider(null, conf)) + assert(e2.getMessage === "Not a valid authentication method") } } diff --git a/kyuubi-server/src/test/scala/yaooqinn/kyuubi/auth/KyuubiAuthFactorySuite.scala b/kyuubi-server/src/test/scala/yaooqinn/kyuubi/auth/KyuubiAuthFactorySuite.scala index f9c4b2c81..b128c171d 100644 --- a/kyuubi-server/src/test/scala/yaooqinn/kyuubi/auth/KyuubiAuthFactorySuite.scala +++ b/kyuubi-server/src/test/scala/yaooqinn/kyuubi/auth/KyuubiAuthFactorySuite.scala @@ -25,7 +25,6 @@ import org.apache.hadoop.security.authorize.AuthorizationException import org.apache.spark.{KyuubiConf, KyuubiSparkUtil, SparkConf, SparkFunSuite} import yaooqinn.kyuubi.KyuubiSQLException -import yaooqinn.kyuubi.server.KyuubiServer import yaooqinn.kyuubi.service.ServiceException import yaooqinn.kyuubi.utils.ReflectUtils @@ -81,6 +80,13 @@ class KyuubiAuthFactorySuite extends SparkFunSuite { assert(e.getMessage === "Unsupported authentication method: OTHER") } + test("AuthType LDAP") { + val conf = new SparkConf(true).set(KyuubiConf.AUTHENTICATION_METHOD.key, "LDAP") + KyuubiSparkUtil.setupCommonConfig(conf) + val authFactory = new KyuubiAuthFactory(conf) + assert(authFactory.getIpAddress.isEmpty) + } + test("AuthType KERBEROS without keytab/principal") { val conf = new SparkConf(true).set(KyuubiConf.AUTHENTICATION_METHOD.key, "KERBEROS") KyuubiSparkUtil.setupCommonConfig(conf)