Skip to content

Commit

Permalink
Check backup/restore state for test insert overwrite case (#105)
Browse files Browse the repository at this point in the history
  • Loading branch information
w41ter authored Jun 6, 2024
1 parent 04110be commit 5e10c66
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions regression-test/suites/table-sync/test_insert_overwrite.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,26 @@ suite("test_insert_overwrite") {
return ret
}

def checkBackupFinishTimesOf = { checkTable, times -> Boolean
Boolean ret = false
while (times > 0) {
def sqlInfo = sql "SHOW BACKUP FROM ${context.dbName}"
for (List<Object> row : sqlInfo) {
if ((row[4] as String).contains(checkTable)) {
ret = row[3] == "FINISHED"
}
}

if (ret) {
break
} else if (--times > 0) {
sleep(sync_gap_time)
}
}

return ret
}

def checkData = { data, beginCol, value -> Boolean
if (data.size() < beginCol + value.size()) {
return false
Expand Down Expand Up @@ -152,6 +172,8 @@ suite("test_insert_overwrite") {
"""
sql "sync"

sleep(10000)
assertTrue(checkBackupFinishTimesOf("${uniqueTable}", 60))
sleep(10000)
assertTrue(checkRestoreFinishTimesOf("${uniqueTable}", 60))

Expand Down

0 comments on commit 5e10c66

Please sign in to comment.