Skip to content

Commit

Permalink
Add more test_alter_database_property regression test
Browse files Browse the repository at this point in the history
  • Loading branch information
JackDrogon committed Jul 26, 2023
1 parent 7d21e70 commit 5eb619e
Showing 1 changed file with 58 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,70 @@ suite("test_alter_database_property") {
result = sql "show create database test_alter_database_property"
logger.info("${result}")

// Case 1: alter database, set binlog enable is true
sql """
alter database test_alter_database_property set properties ("binlog.enable" = "true")
"""
result = sql "show create database test_alter_database_property"
logger.info("${result}")
assertTrue(result.toString().containsIgnoreCase('"binlog.enable" = "true"'))

// Case 2:
// create table, table binlog enable is false, so database binlog enable setting true not success
sql """
alter database test_alter_database_property set properties ("binlog.enable" = "false")
"""
result = sql "show create database test_alter_database_property"
logger.info("${result}")
assertTrue(result.toString().containsIgnoreCase('"binlog.enable" = "false"'))
// create table t1 binlog disable
sql """
CREATE TABLE test_alter_database_property.t1
(
k1 INT
)
ENGINE = olap
DISTRIBUTED BY HASH(k1) BUCKETS 3
PROPERTIES (
"replication_num" = "1"
)
"""
// check enable db binlog error
assertThrows(Exception.class, {
sql """
alter database test_alter_database_property set properties ("binlog.enable" = "true")
"""
})
// set table t1 binlog true
sql """
alter table test_alter_database_property.t1 set ("binlog.enable" = "true");
"""
// check db enable binlog true
sql """
alter database test_alter_database_property set properties ("binlog.enable" = "true")
"""
result = sql "show create database test_alter_database_property"
logger.info("${result}")
assertTrue(result.toString().containsIgnoreCase('"binlog.enable" = "true"'))

// Case 3: table false, db can set binlog.enable = false
sql """
CREATE TABLE test_alter_database_property.t2
(
k1 INT
)
ENGINE = olap
DISTRIBUTED BY HASH(k1) BUCKETS 3
PROPERTIES (
"replication_num" = "1"
)
"""
sql """
alter database test_alter_database_property set properties ("binlog.enable" = "false")
"""
result = sql "show create database test_alter_database_property"
logger.info("${result}")
assertTrue(result.toString().containsIgnoreCase('"binlog.enable" = "false"'))

sql "drop database if exists test_alter_database_property"
}

0 comments on commit 5eb619e

Please sign in to comment.