Skip to content

Commit

Permalink
[fix](cloud) Fix regression case test_nereids_row_policy run in clo…
Browse files Browse the repository at this point in the history
…ud mode (apache#31726)
  • Loading branch information
deardeng authored Mar 4, 2024
1 parent 98671ff commit 08bc414
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions regression-test/suites/account_p0/test_nereids_row_policy.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,18 @@ suite("test_nereids_row_policy") {
def user='row_policy_user'
def tokens = context.config.jdbcUrl.split('/')
def url=tokens[0] + "//" + tokens[2] + "/" + dbName + "?"
def isCloudMode = {
def ret = sql_return_maparray """show backends"""
ret.Tag[0].contains("cloud_cluster_name")
}
def cloudMode = isCloudMode.call()
//cloud-mode
if (cloudMode) {
def clusters = sql " SHOW CLUSTERS; "
assertTrue(!clusters.isEmpty())
def validCluster = clusters[0][0]
sql """GRANT USAGE_PRIV ON CLUSTER ${validCluster} TO ${user}""";
}

def assertQueryResult = { size ->
def result1 = connect(user=user, password='123abc!@#', url=url) {
Expand Down Expand Up @@ -83,6 +95,14 @@ suite("test_nereids_row_policy") {

sql 'sync'

//cloud-mode
if (cloudMode) {
def clusters = sql " SHOW CLUSTERS; "
assertTrue(!clusters.isEmpty())
def validCluster = clusters[0][0]
sql """GRANT USAGE_PRIV ON CLUSTER ${validCluster} TO ${user}""";
}

// no policy
assertQueryResult 3

Expand Down

0 comments on commit 08bc414

Please sign in to comment.