Skip to content

Commit

Permalink
[opt](regression) Fix unstable regression test test_alter_table_prope…
Browse files Browse the repository at this point in the history
…rty and test_compaction_score_action (#46394)

* Enlarge regression test timeout to 100 sec for test_compaction_score_action 
* Fix test_alter_table_property for local mode
  • Loading branch information
gavinchou authored Jan 5, 2025
1 parent 5b384c3 commit 26d68d7
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
7 changes: 3 additions & 4 deletions regression-test/plugins/plugin_curl_requester.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ Suite.metaClass.http_client = { String method, String url /* param */ ->

logger.info("Added 'http_client' function to Suite")

Suite.metaClass.curl = { String method, String url, String body = null /* param */->
Suite.metaClass.curl = { String method, String url, String body = null, Integer timeoutSec = 10 /* param */->
Suite suite = delegate as Suite
if (method != "GET" && method != "POST") {
throw new Exception(String.format("invalid curl method: %s", method))
Expand All @@ -121,16 +121,15 @@ Suite.metaClass.curl = { String method, String url, String body = null /* param
throw new Exception("invalid curl url, blank")
}

Integer timeout = 10; // 10 seconds;
Integer maxRetries = 10; // Maximum number of retries
Integer retryCount = 0; // Current retry count
Integer sleepTime = 5000; // Sleep time in milliseconds

String cmd
if (method == "POST" && body != null) {
cmd = String.format("curl --max-time %d -X %s -H Content-Type:application/json -d %s %s", timeout, method, body, url).toString()
cmd = String.format("curl --max-time %d -X %s -H Content-Type:application/json -d %s %s", timeoutSec, method, body, url).toString()
} else {
cmd = String.format("curl --max-time %d -X %s %s", timeout, method, url).toString()
cmd = String.format("curl --max-time %d -X %s %s", timeoutSec, method, url).toString()
}

logger.info("curl cmd: " + cmd)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,12 @@ suite("test_compaction_score_action") {
for (int i=0;i<backendId_to_backendIP.size();i++){
def beHttpAddress =backendId_to_backendIP.entrySet()[i].getValue()+":"+backendId_to_backendHttpPort.entrySet()[i].getValue()
if (isCloudMode()) {
def (code, text, err) = curl("GET",beHttpAddress+ "/api/compaction_score?top_n=1&sync_meta=true")
def (code, text, err) = curl("GET", beHttpAddress+ "/api/compaction_score?top_n=1&sync_meta=true", null/*body*/, 100/*timeoutSec*/)
def score_str = parseJson(text).get(0).get("compaction_score")
def score = Integer.parseInt(score_str)
assertTrue(score >= 90)
} else {
def (code, text, err) = curl("GET",beHttpAddress+"/api/compaction_score?top_n=1")
def (code, text, err) = curl("GET", beHttpAddress+"/api/compaction_score?top_n=1")
def score_str = parseJson(text).get(0).get("compaction_score")
def score = Integer.parseInt(score_str)
assertTrue(score >= 90)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,8 @@ suite("test_alter_table_property") {
sql """
alter table ${tableName} set ("file_cache_ttl_seconds" = "86400")
"""
exception "modifying property [file_cache_ttl_seconds] is forbidden"
// exception "modifying property [file_cache_ttl_seconds] is forbidden"
exception "Cann't modify property 'file_cache_ttl_seconds'"
}
} else {
test {
Expand Down

0 comments on commit 26d68d7

Please sign in to comment.