You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@kyuubi.apache.org by "bowenliang123 (via GitHub)" <gi...@apache.org> on 2023/02/28 02:35:34 UTC

[GitHub] [kyuubi] bowenliang123 commented on a diff in pull request #4427: Simplify assertions in Authz tests in declarative style

bowenliang123 commented on code in PR #4427:
URL: https://github.com/apache/kyuubi/pull/4427#discussion_r1119514967


##########
extensions/spark/kyuubi-spark-authz/src/test/scala/org/apache/kyuubi/plugin/spark/authz/SparkSessionProvider.scala:
##########
@@ -71,23 +75,78 @@ trait SparkSessionProvider {
 
   protected val sql: String => DataFrame = spark.sql
 
-  protected def doAs[T](user: String, f: => T): T = {
+  protected def doAs[T](user: String)(f: => T): T = {
     UserGroupInformation.createRemoteUser(user).doAs[T](
       new PrivilegedExceptionAction[T] {
         override def run(): T = f
       })
   }
+
+  protected def runSqlAs(user: String)(

Review Comment:
   It's not forcing user/developer to use `runSqlAs`. `runSqlAs` and `runSqlAsWithAccessException` are together providing a concentrative and declarative way in most general scenarios to decide running what SQL in which user with asserting what messages. `doAs` is still good to be used with them,  and remained as you see. 



-- 
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: notifications-unsubscribe@kyuubi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@kyuubi.apache.org
For additional commands, e-mail: notifications-help@kyuubi.apache.org