Skip to content

Commit

Permalink
[Test] add test for check show create table sql (#45002)
Browse files Browse the repository at this point in the history
  • Loading branch information
wyxxxcat authored Dec 5, 2024
1 parent ab29448 commit 3172986
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions regression-test/suites/check_before_quit/check_before_quit.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -237,5 +237,31 @@ suite("check_before_quit", "nonConcurrent,p0") {

Thread.sleep(2000)
}

// check create table sql
List<List<Object>> allDataBases = sql "show databases;"
logger.info("show all databases: ${allDataBases}")

def num = allDataBases.size()

for (int i = 0; i < allDataBases.size(); i++) {
def db = allDataBases[i][0]
if (db == "__internal_schema" || db == "information_schema" || db == "mysql") {
continue
}
List<List<Object>> allTables = sql "show tables from ${db}"
logger.info("show all tabkes: ${allTables}")
for (int j = 0;j < allTables.size();j ++) {
def tbl = allTables[j][0]
def createTableSql = sql "show create table ${db}.${tbl}"
logger.info("create table sql info: ${createTableSql}")
sql "drop table if exists ${tbl}"
sql(createTableSql[0][1])
def createTableSqlResult = sql "show create table ${tbl}"
logger.info("create table sql result info: ${createTableSqlResult}")
assertEquals(createTableSqlResult, createTableSql)
}
}

assertTrue(clear)
}

0 comments on commit 3172986

Please sign in to comment.