pan3793 commented on code in PR #5705:
URL: https://github.com/apache/kyuubi/pull/5705#discussion_r1400675391


##########
kyuubi-server/src/test/scala/org/apache/kyuubi/server/api/v1/AdminResourceSuite.scala:
##########
@@ -545,6 +607,67 @@ class AdminResourceSuite extends KyuubiFunSuite with 
RestFrontendTestHelper {
     }
   }
 
+  test("list engine - user share level & proxyUser") {
+    val normalUser = "kyuubi"
+
+    val id = UUID.randomUUID().toString
+    conf.set(KyuubiConf.ENGINE_SHARE_LEVEL, USER.toString)
+    conf.set(KyuubiConf.ENGINE_TYPE, SPARK_SQL.toString)
+    conf.set(KyuubiConf.FRONTEND_THRIFT_BINARY_BIND_PORT, 0)
+    conf.set(HighAvailabilityConf.HA_NAMESPACE, "kyuubi_test")
+    conf.set(KyuubiConf.GROUP_PROVIDER, "hadoop")
+
+    // In EngineRef, when use hive.server2.proxy.user or 
kyuubi.session.proxy.user
+    // the user is the proxyUser, and in our test it is normalUser
+    val engine =
+    new EngineRef(conf.clone, user = normalUser, 
PluginLoader.loadGroupProvider(conf), id, null)
+
+    // so as the firstChild in engineSpace we use normalUser
+    val engineSpace = DiscoveryPaths.makePath(
+      s"kyuubi_test_${KYUUBI_VERSION}_USER_SPARK_SQL",
+      normalUser,
+      "")
+
+    withDiscoveryClient(conf) { client =>
+      engine.getOrCreate(client)
+
+      assert(client.pathExists(engineSpace))
+      assert(client.getChildren(engineSpace).size == 1)
+
+      def runListEngine(kyuubiProxyUser: Option[String], hs2ProxyUser: 
Option[String]): Response = {
+        var internalWebTarget = webTarget.path("api/v1/admin/engine")
+          .queryParam("sharelevel", "USER")
+          .queryParam("type", "SPARK_SQL")
+
+        kyuubiProxyUser.map(username =>
+          internalWebTarget = internalWebTarget.queryParam("proxyUser", 
username))
+        hs2ProxyUser.map(username =>
+          internalWebTarget = 
internalWebTarget.queryParam("hive.server2.proxy.user", username))

Review Comment:
   ```suggestion
           kyuubiProxyUser.map { username =>
             internalWebTarget = internalWebTarget.queryParam("proxyUser", 
username)
           }
           hs2ProxyUser.map { username =>
             internalWebTarget = 
internalWebTarget.queryParam("hive.server2.proxy.user", username)
           }
   ```



-- 
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