Skip to content

Commit

Permalink
add case
Browse files Browse the repository at this point in the history
  • Loading branch information
zddr committed Dec 16, 2024
1 parent 93c8d6b commit 23cf9e2
Showing 1 changed file with 55 additions and 0 deletions.
55 changes: 55 additions & 0 deletions regression-test/suites/auth_p0/test_frontends_disks_auth.groovy
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
// Licensed to the Apache Software Foundation (ASF) under one
// or more contributor license agreements. See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership. The ASF licenses this file
// to you under the Apache License, Version 2.0 (the
// "License"); you may not use this file except in compliance
// with the License. You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing,
// software distributed under the License is distributed on an
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.

import org.junit.Assert;

suite("test_frontends_disks_auth","p0,auth") {
String suiteName = "test_frontends_disks_auth"
String user = "${suiteName}_user"
String pwd = 'C123_567p'
try_sql("DROP USER ${user}")
sql """CREATE USER '${user}' IDENTIFIED BY '${pwd}'"""

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

sql """grant select_priv on regression_test to ${user}"""

connect(user=user, password="${pwd}", url=context.config.jdbcUrl) {
test {
sql """
select * from frontends_disks();
"""
exception "denied"
}
}

sql """grant admin_priv on *.*.* to ${user}"""

connect(user=user, password="${pwd}", url=context.config.jdbcUrl) {
sql """
select * from frontends_disks();
"""
}

try_sql("DROP USER ${user}")
}

0 comments on commit 23cf9e2

Please sign in to comment.