Skip to content

Commit

Permalink
[fix](cloud) Fix some test_manager_interface case run in cloud mode (
Browse files Browse the repository at this point in the history
…apache#38138)

## Proposed changes

Issue Number: close #xxx

<!--Describe your changes.-->
  • Loading branch information
deardeng authored Jul 22, 2024
1 parent 47dfd41 commit d1e7dbc
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 12 deletions.
24 changes: 12 additions & 12 deletions regression-test/suites/manager/test_manager_interface_1.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -325,18 +325,18 @@ DISTRIBUTED BY HASH(`k1`) BUCKETS 1"""))
logger.info("result = ${result}" )
assertTrue(result.size() == 1)
assertTrue(result[0][0] == "test_manager_tb_2")
def ddl_str = result[0][1]
def idx = ddl_str.indexOf("min_load_replica_num")
assertTrue( ddl_str.substring(idx,ddl_str.length()).startsWith("""min_load_replica_num" = "-1"""))

sql """alter table test_manager_tb_2 set ("min_load_replica_num" = "1")"""
result = sql """ show create table test_manager_tb_2 """
assertTrue(result[0][0] == "test_manager_tb_2")
ddl_str = result[0][1]
idx = ddl_str.indexOf("min_load_replica_num")
assertTrue( ddl_str.substring(idx,ddl_str.length()).startsWith("""min_load_replica_num" = "1"""))


if (!isCloudMode()) {
def ddl_str = result[0][1]
def idx = ddl_str.indexOf("min_load_replica_num")
assertTrue( ddl_str.substring(idx,ddl_str.length()).startsWith("""min_load_replica_num" = "-1"""))

sql """alter table test_manager_tb_2 set ("min_load_replica_num" = "1")"""
result = sql """ show create table test_manager_tb_2 """
assertTrue(result[0][0] == "test_manager_tb_2")
ddl_str = result[0][1]
idx = ddl_str.indexOf("min_load_replica_num")
assertTrue( ddl_str.substring(idx,ddl_str.length()).startsWith("""min_load_replica_num" = "1"""))
}

sql """ DROP table test_manager_tb_2 FORCE"""
sql """ drop database test_manager_tb_properties_case FORCE"""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -318,6 +318,9 @@ suite('test_manager_interface_2',"p0") {
sql """ ALTER TABLE internal.__internal_schema.column_statistics SET ("replication_num" = "1") """

}
if (isCloudMode()) {
return
}
test_system()


Expand Down
22 changes: 22 additions & 0 deletions regression-test/suites/manager/test_manager_interface_3.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,14 @@ suite('test_manager_interface_3',"p0") {

sql """CREATE USER '${user1}' IDENTIFIED BY '${pwd}' default role '${role1}' """
sql """CREATE USER '${user2}' 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 ${user1}""";
sql """GRANT USAGE_PRIV ON CLUSTER ${validCluster} TO ${user2}""";
}

connect(user=user1, password="${pwd}", url=url) {
test {
Expand Down Expand Up @@ -399,6 +407,13 @@ suite('test_manager_interface_3',"p0") {
sql """grant USAGE_PRIV on RESOURCE ${resource_name} TO ROLE '${role}' """

sql """CREATE USER '${user}' IDENTIFIED BY '${pwd}' default role '${role}' """
//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}""";
}

List<List<Object>> result = sql """ show resources """

Expand Down Expand Up @@ -589,6 +604,13 @@ suite('test_manager_interface_3',"p0") {
sql """drop user if exists ${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}""";
}

connect(user=user, password="${pwd}", url=url) {
List<List<Object>> result = sql """ show property like "max_query_instances" """
Expand Down

0 comments on commit d1e7dbc

Please sign in to comment.