Skip to content

Commit

Permalink
Update RangerSparkExtensionSuite.scala
Browse files Browse the repository at this point in the history
  • Loading branch information
AngersZhuuuu committed Jan 22, 2024
1 parent 49f09fb commit e085455
Showing 1 changed file with 9 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -188,8 +188,8 @@ abstract class RangerSparkExtensionSuite extends AnyFunSuite
val e = intercept[AccessControlException](sql(create))
assert(e.getMessage === errorMessage("create", "mydb"))
withCleanTmpResources(Seq((testDb, "database"))) {
doAs(admin, assert(Try {sql(create)}.isSuccess))
doAs(admin, assert(Try {sql(alter)}.isSuccess))
doAs(admin, assert(Try { sql(create) }.isSuccess))
doAs(admin, assert(Try { sql(alter) }.isSuccess))
val e1 = intercept[AccessControlException](sql(alter))
assert(e1.getMessage === errorMessage("alter", "mydb"))
val e2 = intercept[AccessControlException](sql(drop))
Expand All @@ -211,14 +211,14 @@ abstract class RangerSparkExtensionSuite extends AnyFunSuite
assert(e.getMessage === errorMessage("create"))

withCleanTmpResources(Seq((s"$db.$table", "table"))) {
doAs(bob, assert(Try {sql(create0)}.isSuccess))
doAs(bob, assert(Try {sql(alter0)}.isSuccess))
doAs(bob, assert(Try { sql(create0) }.isSuccess))
doAs(bob, assert(Try { sql(alter0) }.isSuccess))

val e1 = intercept[AccessControlException](sql(drop0))
assert(e1.getMessage === errorMessage("drop"))
doAs(bob, assert(Try {sql(alter0)}.isSuccess))
doAs(bob, assert(Try {sql(select).collect()}.isSuccess))
doAs(kent, assert(Try {sql(s"SELECT key FROM $db.$table").collect()}.isSuccess))
doAs(bob, assert(Try { sql(alter0) }.isSuccess))
doAs(bob, assert(Try { sql(select).collect() }.isSuccess))
doAs(kent, assert(Try { sql(s"SELECT key FROM $db.$table").collect() }.isSuccess))

Seq(
select,
Expand Down Expand Up @@ -598,12 +598,12 @@ class HiveCatalogRangerSparkExtensionSuite extends RangerSparkExtensionSuite {
// query all columns of the permanent view
// with access privileges to the permanent view but no privilege to the source table
val sql1 = s"SELECT * FROM $db1.$permView"
doAs(userPermViewOnly, {sql(sql1).collect()})
doAs(userPermViewOnly, { sql(sql1).collect() })

// query the second column of permanent view with multiple columns
// with access privileges to the permanent view but no privilege to the source table
val sql2 = s"SELECT name FROM $db1.$permView"
doAs(userPermViewOnly, {sql(sql2).collect()})
doAs(userPermViewOnly, { sql(sql2).collect() })
}
}

Expand Down

0 comments on commit e085455

Please sign in to comment.