This is an automated email from the ASF dual-hosted git repository.
zouxinyi pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/master by this push:
new 4514d0f52b2 [Enhancement]use awaitility.await() add in variant and
schema testcase (#38836)
4514d0f52b2 is described below
commit 4514d0f52b220303cedad0bcdc3b3fef7961f705
Author: Vallish Pai <[email protected]>
AuthorDate: Thu Aug 29 13:40:07 2024 +0530
[Enhancement]use awaitility.await() add in variant and schema testcase
(#38836)
close #37817
use awaitility in variant schema_change testcases.
---
.../test_agg_keys_schema_change_datev2.groovy | 99 +++++--------
.../test_schema_change_varchar_to_datev2.groovy | 26 ++--
.../test_agg_keys_schema_change_decimalv2.groovy | 156 +++++++--------------
.../test_agg_keys_schema_change_decimalv3.groovy | 83 ++++-------
.../test_varchar_schema_change.groovy | 51 +++----
.../variant_p0/compaction/test_compaction.groovy | 9 +-
.../variant_p0/compaction_sparse_column.groovy | 9 +-
7 files changed, 152 insertions(+), 281 deletions(-)
diff --git
a/regression-test/suites/schema_change_p0/datev2/test_agg_keys_schema_change_datev2.groovy
b/regression-test/suites/schema_change_p0/datev2/test_agg_keys_schema_change_datev2.groovy
index 956df9371cb..3a92de35b8f 100644
---
a/regression-test/suites/schema_change_p0/datev2/test_agg_keys_schema_change_datev2.groovy
+++
b/regression-test/suites/schema_change_p0/datev2/test_agg_keys_schema_change_datev2.groovy
@@ -16,6 +16,8 @@
// under the License.
import org.codehaus.groovy.runtime.IOGroovyMethods
+import java.util.concurrent.TimeUnit
+import org.awaitility.Awaitility
suite("test_agg_keys_schema_change_datev2") {
def tbName = "test_agg_keys_schema_change_datev2"
@@ -49,9 +51,7 @@ suite("test_agg_keys_schema_change_datev2") {
// wait for all compactions done
for (String[] tablet in tablets) {
- boolean running = true
- do {
- Thread.sleep(100)
+ Awaitility.await().untilAsserted(() -> {
String tablet_id = tablet[0]
backend_id = tablet[2]
(code, out, err) =
be_get_compaction_status(backendId_to_backendIP.get(backend_id),
backendId_to_backendHttpPort.get(backend_id), tablet_id)
@@ -59,8 +59,8 @@ suite("test_agg_keys_schema_change_datev2") {
assertEquals(code, 0)
def compactionStatus = parseJson(out.trim())
assertEquals("success", compactionStatus.status.toLowerCase())
- running = compactionStatus.run_status
- } while (running)
+ return compactionStatus.run_status;
+ });
}
}
@@ -93,19 +93,15 @@ suite("test_agg_keys_schema_change_datev2") {
qt_sql """select * from ${tbName} ORDER BY `datek1`;"""
sql """ alter table ${tbName} add column `datev3` datev2 DEFAULT
'2022-01-01' """
- int max_try_time = 1000
- while (max_try_time--){
+ int max_try_secs = 300
+ Awaitility.await().atMost(max_try_secs,
TimeUnit.SECONDS).with().pollDelay(100, TimeUnit.MILLISECONDS).await().until(()
-> {
String result = getJobState(tbName)
if (result == "FINISHED") {
- sleep(3000)
- break
- } else {
- sleep(100)
- if (max_try_time < 1){
- assertEquals(1,2)
- }
+ return true;
}
- }
+ return false;
+ });
+
sql """sync"""
qt_sql """select * from ${tbName} ORDER BY `datek1`;"""
do_compact(tbName)
@@ -115,19 +111,13 @@ suite("test_agg_keys_schema_change_datev2") {
sql """sync"""
qt_sql """select * from ${tbName} ORDER BY `datek1`;"""
sql """ alter table ${tbName} drop column `datev3` """
- max_try_time = 1000
- while (max_try_time--){
+ Awaitility.await().atMost(max_try_secs,
TimeUnit.SECONDS).with().pollDelay(100, TimeUnit.MILLISECONDS).await().until(()
-> {
String result = getJobState(tbName)
if (result == "FINISHED") {
- sleep(3000)
- break
- } else {
- sleep(100)
- if (max_try_time < 1){
- assertEquals(1,2)
- }
+ return true;
}
- }
+ return false;
+ });
// datetimev2(0)
sql """ insert into ${tbName} values('2022-01-02', '2022-01-02 11:11:11',
'2022-01-02', '2022-01-02 11:11:11');"""
@@ -144,19 +134,13 @@ suite("test_agg_keys_schema_change_datev2") {
sql """sync"""
qt_sql """select * from ${tbName} ORDER BY `datek1`;"""
sql """ alter table ${tbName} add column `datev3` datetimev2 DEFAULT
'2022-01-01 11:11:11' """
- max_try_time = 1000
- while (max_try_time--){
+ Awaitility.await().atMost(max_try_secs,
TimeUnit.SECONDS).with().pollDelay(100, TimeUnit.MILLISECONDS).await().until(()
-> {
String result = getJobState(tbName)
if (result == "FINISHED") {
- sleep(3000)
- break
- } else {
- sleep(100)
- if (max_try_time < 1){
- assertEquals(1,2)
- }
+ return true;
}
- }
+ return false;
+ });
sql """sync"""
qt_sql """select * from ${tbName} ORDER BY `datek1`;"""
do_compact(tbName)
@@ -166,19 +150,13 @@ suite("test_agg_keys_schema_change_datev2") {
sql """sync"""
qt_sql """select * from ${tbName} ORDER BY `datek1`;"""
sql """ alter table ${tbName} drop column `datev3` """
- max_try_time = 1000
- while (max_try_time--){
+ Awaitility.await().atMost(max_try_secs,
TimeUnit.SECONDS).with().pollDelay(100, TimeUnit.MILLISECONDS).await().until(()
-> {
String result = getJobState(tbName)
if (result == "FINISHED") {
- sleep(3000)
- break
- } else {
- sleep(100)
- if (max_try_time < 1){
- assertEquals(1,2)
- }
+ return true;
}
- }
+ return false;
+ });
// datetimev2(3)
sql """ insert into ${tbName} values('2022-01-02', '2022-01-02 11:11:11',
'2022-01-02', '2022-01-02 11:11:11');"""
@@ -195,19 +173,15 @@ suite("test_agg_keys_schema_change_datev2") {
sql """sync"""
qt_sql """select * from ${tbName} ORDER BY `datek1`;"""
sql """ alter table ${tbName} add column `datev3` datetimev2(3) DEFAULT
'2022-01-01 11:11:11.111' """
- max_try_time = 1000
- while (max_try_time--){
+
+ Awaitility.await().atMost(max_try_secs,
TimeUnit.SECONDS).with().pollDelay(100, TimeUnit.MILLISECONDS).await().until(()
-> {
String result = getJobState(tbName)
if (result == "FINISHED") {
- sleep(3000)
- break
- } else {
- sleep(100)
- if (max_try_time < 1){
- assertEquals(1,2)
- }
+ return true;
}
- }
+ return false;
+ });
+
sql """sync"""
qt_sql """select * from ${tbName} ORDER BY `datek1`;"""
do_compact(tbName)
@@ -225,19 +199,14 @@ suite("test_agg_keys_schema_change_datev2") {
sql """sync"""
qt_sql """select * from ${tbName} ORDER BY `datek1`;"""
sql """ alter table ${tbName} drop column `datev3` """
- max_try_time = 1000
- while (max_try_time--){
+
+ Awaitility.await().atMost(max_try_secs,
TimeUnit.SECONDS).with().pollDelay(100, TimeUnit.MILLISECONDS).await().until(()
-> {
String result = getJobState(tbName)
if (result == "FINISHED") {
- sleep(3000)
- break
- } else {
- sleep(100)
- if (max_try_time < 1){
- assertEquals(1,2)
- }
+ return true;
}
- }
+ return false;
+ });
sql """ DROP TABLE ${tbName} force"""
}
diff --git
a/regression-test/suites/schema_change_p0/datev2/test_schema_change_varchar_to_datev2.groovy
b/regression-test/suites/schema_change_p0/datev2/test_schema_change_varchar_to_datev2.groovy
index 89874a8679d..d01d8cd54f3 100644
---
a/regression-test/suites/schema_change_p0/datev2/test_schema_change_varchar_to_datev2.groovy
+++
b/regression-test/suites/schema_change_p0/datev2/test_schema_change_varchar_to_datev2.groovy
@@ -16,6 +16,8 @@
// under the License.
import org.codehaus.groovy.runtime.IOGroovyMethods
+import java.util.concurrent.TimeUnit
+import org.awaitility.Awaitility
suite("test_schema_change_varchar_to_datev2") {
def tbName = "test_schema_change_varchar_to_datev2"
@@ -48,9 +50,7 @@ suite("test_schema_change_varchar_to_datev2") {
// wait for all compactions done
for (String[] tablet in tablets) {
- boolean running = true
- do {
- Thread.sleep(100)
+ Awaitility.await().untilAsserted(() -> {
String tablet_id = tablet[0]
backend_id = tablet[2]
(code, out, err) =
be_get_compaction_status(backendId_to_backendIP.get(backend_id),
backendId_to_backendHttpPort.get(backend_id), tablet_id)
@@ -58,8 +58,8 @@ suite("test_schema_change_varchar_to_datev2") {
assertEquals(code, 0)
def compactionStatus = parseJson(out.trim())
assertEquals("success", compactionStatus.status.toLowerCase())
- running = compactionStatus.run_status
- } while (running)
+ return compactionStatus.run_status;
+ });
}
}
@@ -84,19 +84,15 @@ suite("test_schema_change_varchar_to_datev2") {
qt_sql_1 """select * from ${tbName} ORDER BY `k1`;"""
sql """ alter table ${tbName} modify column `k3` date; """
- int max_try_time = 1000
- while (max_try_time--){
+ int max_try_secs = 300
+ Awaitility.await().atMost(max_try_secs,
TimeUnit.SECONDS).with().pollDelay(100, TimeUnit.MILLISECONDS).await().until(()
-> {
String result = getJobState(tbName)
if (result == "FINISHED") {
- sleep(3000)
- break
- } else {
- sleep(100)
- if (max_try_time < 1){
- assertEquals(1,2)
- }
+ return true;
}
- }
+ return false;
+ });
+
sql """sync"""
qt_sql_2 """select * from ${tbName} ORDER BY `k1`;"""
diff --git
a/regression-test/suites/schema_change_p0/decimalv2/test_agg_keys_schema_change_decimalv2.groovy
b/regression-test/suites/schema_change_p0/decimalv2/test_agg_keys_schema_change_decimalv2.groovy
index 88798db3c6c..295a034d8ee 100644
---
a/regression-test/suites/schema_change_p0/decimalv2/test_agg_keys_schema_change_decimalv2.groovy
+++
b/regression-test/suites/schema_change_p0/decimalv2/test_agg_keys_schema_change_decimalv2.groovy
@@ -16,6 +16,8 @@
// under the License.
import org.codehaus.groovy.runtime.IOGroovyMethods
+import java.util.concurrent.TimeUnit
+import org.awaitility.Awaitility
suite("test_agg_keys_schema_change_decimalv2", "nonConcurrent") {
def config_row = sql """ ADMIN SHOW FRONTEND CONFIG LIKE
'disable_decimalv2'; """
@@ -62,9 +64,7 @@ suite("test_agg_keys_schema_change_decimalv2",
"nonConcurrent") {
// wait for all compactions done
for (String[] tablet in tablets) {
- boolean running = true
- do {
- Thread.sleep(100)
+ Awaitility.await().untilAsserted(() -> {
String tablet_id = tablet[0]
backend_id = tablet[2]
(code, out, err) =
be_get_compaction_status(backendId_to_backendIP.get(backend_id),
backendId_to_backendHttpPort.get(backend_id), tablet_id)
@@ -72,8 +72,8 @@ suite("test_agg_keys_schema_change_decimalv2",
"nonConcurrent") {
assertEquals(code, 0)
def compactionStatus = parseJson(out.trim())
assertEquals("success", compactionStatus.status.toLowerCase())
- running = compactionStatus.run_status
- } while (running)
+ return compactionStatus.run_status;
+ });
}
}
@@ -98,19 +98,15 @@ suite("test_agg_keys_schema_change_decimalv2",
"nonConcurrent") {
qt_sql1 """select * from ${tbName} ORDER BY 1,2,3,4;"""
sql """ alter table ${tbName} add column `decimalv2v3` decimalv2(27,9) """
- int max_try_time = 1000
- while (max_try_time--){
+ int max_try_secs = 300
+ Awaitility.await().atMost(max_try_secs,
TimeUnit.SECONDS).with().pollDelay(500, TimeUnit.MILLISECONDS).await().until(()
-> {
String result = getJobState(tbName)
if (result == "FINISHED") {
- sleep(3000)
- break
- } else {
- sleep(1000)
- if (max_try_time < 1){
- assertEquals(1,2)
- }
+ return true;
}
- }
+ return false;
+ });
+
sql """sync"""
qt_sql2 """select * from ${tbName} ORDER BY 1,2,3,4;"""
do_compact(tbName)
@@ -118,112 +114,81 @@ suite("test_agg_keys_schema_change_decimalv2",
"nonConcurrent") {
qt_sql3 """select * from ${tbName} ORDER BY 1,2,3,4;"""
sql """ alter table ${tbName} drop column `decimalv2v3` """
- max_try_time = 1000
- while (max_try_time--){
+ Awaitility.await().atMost(max_try_secs,
TimeUnit.SECONDS).with().pollDelay(500, TimeUnit.MILLISECONDS).await().until(()
-> {
String result = getJobState(tbName)
if (result == "FINISHED") {
- sleep(3000)
- break
- } else {
- sleep(1000)
- if (max_try_time < 1){
- assertEquals(1,2)
- }
+ return true;
}
- }
+ return false;
+ });
sql """sync"""
qt_sql4 """select * from ${tbName} ORDER BY 1,2,3,4;"""
// DECIMALV2(21,3) -> decimalv3 OK
sql """ alter table ${tbName} modify column decimalv2k2 DECIMALV3(21,3)
key """
- max_try_time = 1000
- while (max_try_time--){
+ Awaitility.await().atMost(max_try_secs,
TimeUnit.SECONDS).with().pollDelay(500, TimeUnit.MILLISECONDS).await().until(()
-> {
String result = getJobState(tbName)
if (result == "FINISHED") {
- sleep(3000)
- break
- } else {
- sleep(1000)
- if (max_try_time < 1){
- assertEquals(1,2)
- }
+ return true;
}
- }
+ return false;
+ });
sql """sync"""
qt_sql5 """select * from ${tbName} ORDER BY 1,2,3,4;"""
// DECIMALV2(21,3) -> decimalv3 OK
sql """ alter table ${tbName} modify column decimalv2k3 DECIMALV3(38,10)
key """
- max_try_time = 1000
- while (max_try_time--){
+ Awaitility.await().atMost(max_try_secs,
TimeUnit.SECONDS).with().pollDelay(500, TimeUnit.MILLISECONDS).await().until(()
-> {
String result = getJobState(tbName)
if (result == "FINISHED") {
- sleep(3000)
- break
- } else {
- sleep(1000)
- if (max_try_time < 1){
- assertEquals(1,2)
- }
+ return true;
}
- }
+ return false;
+ });
sql """sync"""
qt_sql5_2 """select * from ${tbName} ORDER BY 1,2,3,4;"""
// DECIMALV2(27,9) -> decimalv3, round scale part, not overflow
sql """ alter table ${tbName} modify column decimalv2v1 DECIMALV3(26,8)
sum """
- max_try_time = 1000
- while (max_try_time--){
+ Awaitility.await().atMost(max_try_secs,
TimeUnit.SECONDS).with().pollDelay(500, TimeUnit.MILLISECONDS).await().until(()
-> {
String result = getJobState(tbName)
if (result == "FINISHED") {
- sleep(3000)
- break
- } else {
- sleep(1000)
- if (max_try_time < 1){
- assertEquals(1,2)
- }
+ return true;
}
- }
+ return false;
+ });
+
sql """sync"""
qt_sql6 """select * from ${tbName} ORDER BY 1,2,3,4;"""
// DECIMALV2(21,3) -> decimalv3, round scale part, overflow
sql """ alter table ${tbName} modify column decimalv2v2 DECIMALV3(20,2)
sum """
- max_try_time = 1000
- while (max_try_time--){
+ Awaitility.await().atMost(max_try_secs,
TimeUnit.SECONDS).with().pollDelay(500, TimeUnit.MILLISECONDS).await().until(()
-> {
String result = getJobState(tbName)
if (result == "CANCELLED") {
- break
- } else {
- sleep(1000)
- if (max_try_time < 1){
- assertEquals(1,2)
- }
+ return true;
}
- }
+ return false;
+ });
+
sql """sync"""
qt_sql7 """select * from ${tbName} ORDER BY 1,2,3,4;"""
// DECIMALV2(21,3) -> decimalv3, narrow integral, overflow
sql """ alter table ${tbName} modify column decimalv2v2 DECIMALV3(20,3)
sum """
- max_try_time = 1000
- while (max_try_time--){
+ Awaitility.await().atMost(max_try_secs,
TimeUnit.SECONDS).with().pollDelay(500, TimeUnit.MILLISECONDS).await().until(()
-> {
String result = getJobState(tbName)
if (result == "CANCELLED") {
- break
- } else {
- sleep(1000)
- if (max_try_time < 1){
- assertEquals(1,2)
- }
+ return true;
}
- }
+ return false;
+ });
+
sql """sync"""
qt_sql8 """select * from ${tbName} ORDER BY 1,2,3,4;"""
@@ -231,57 +196,42 @@ suite("test_agg_keys_schema_change_decimalv2",
"nonConcurrent") {
// DECIMALV3(21,3) -> decimalv2 OK
sql """ alter table ${tbName} modify column decimalv2k2 DECIMALV2(21,3)
key """
- max_try_time = 1000
- while (max_try_time--){
+ Awaitility.await().atMost(max_try_secs,
TimeUnit.SECONDS).with().pollDelay(500, TimeUnit.MILLISECONDS).await().until(()
-> {
String result = getJobState(tbName)
if (result == "FINISHED") {
- sleep(3000)
- break
- } else {
- sleep(1000)
- if (max_try_time < 1){
- assertEquals(1,2)
- }
+ return true;
}
- }
+ return false;
+ });
+
sql """sync"""
qt_sql9 """select * from ${tbName} ORDER BY 1,2,3,4;"""
// DECIMALV3(26,8) -> decimalv2
sql """ alter table ${tbName} modify column decimalv2v1 DECIMALV2(25,7)
sum """
- max_try_time = 1000
- while (max_try_time--){
+ Awaitility.await().atMost(max_try_secs,
TimeUnit.SECONDS).with().pollDelay(500, TimeUnit.MILLISECONDS).await().until(()
-> {
String result = getJobState(tbName)
if (result == "FINISHED") {
- sleep(3000)
- break
- } else {
- sleep(1000)
- if (max_try_time < 1){
- assertEquals(1,2)
- }
+ return true;
}
- }
+ return false;
+ });
+
sql """sync"""
qt_sql9_2 """select * from ${tbName} ORDER BY 1,2,3,4;"""
// DECIMALV3(26,8) -> decimalv2, narrow integer
sql """ alter table ${tbName} modify column decimalv2v1 DECIMALV2(25,8)
sum """
- max_try_time = 1000
- while (max_try_time--){
+ Awaitility.await().atMost(max_try_secs,
TimeUnit.SECONDS).with().pollDelay(500, TimeUnit.MILLISECONDS).await().until(()
-> {
String result = getJobState(tbName)
if (result == "FINISHED") {
- sleep(3000)
- break
- } else {
- sleep(1000)
- if (max_try_time < 1){
- assertEquals(1,2)
- }
+ return true;
}
- }
+ return false;
+ });
+
sql """sync"""
qt_sql9_3 """select * from ${tbName} ORDER BY 1,2,3,4;"""
diff --git
a/regression-test/suites/schema_change_p0/decimalv3/test_agg_keys_schema_change_decimalv3.groovy
b/regression-test/suites/schema_change_p0/decimalv3/test_agg_keys_schema_change_decimalv3.groovy
index 41f2a32854a..fd28d01ed45 100644
---
a/regression-test/suites/schema_change_p0/decimalv3/test_agg_keys_schema_change_decimalv3.groovy
+++
b/regression-test/suites/schema_change_p0/decimalv3/test_agg_keys_schema_change_decimalv3.groovy
@@ -16,6 +16,8 @@
// under the License.
import org.codehaus.groovy.runtime.IOGroovyMethods
+import java.util.concurrent.TimeUnit
+import org.awaitility.Awaitility
suite("test_agg_keys_schema_change_decimalv3") {
def tbName = "test_agg_keys_schema_change_decimalv3"
@@ -49,9 +51,7 @@ suite("test_agg_keys_schema_change_decimalv3") {
// wait for all compactions done
for (String[] tablet in tablets) {
- boolean running = true
- do {
- Thread.sleep(100)
+ Awaitility.await().untilAsserted(() -> {
String tablet_id = tablet[0]
backend_id = tablet[2]
(code, out, err) =
be_get_compaction_status(backendId_to_backendIP.get(backend_id),
backendId_to_backendHttpPort.get(backend_id), tablet_id)
@@ -59,8 +59,8 @@ suite("test_agg_keys_schema_change_decimalv3") {
assertEquals(code, 0)
def compactionStatus = parseJson(out.trim())
assertEquals("success", compactionStatus.status.toLowerCase())
- running = compactionStatus.run_status
- } while (running)
+ return compactionStatus.run_status;
+ });
}
}
@@ -82,91 +82,64 @@ suite("test_agg_keys_schema_change_decimalv3") {
qt_sql """select * from ${tbName} ORDER BY `decimalv3k1`;"""
sql """ alter table ${tbName} add column `decimalv3v3` DECIMALV3(38,4) """
- int max_try_time = 1000
- while (max_try_time--){
+ int max_try_secs = 300
+ Awaitility.await().atMost(max_try_secs,
TimeUnit.SECONDS).with().pollDelay(100, TimeUnit.MILLISECONDS).await().until(()
-> {
String result = getJobState(tbName)
if (result == "FINISHED") {
- sleep(3000)
- break
- } else {
- sleep(1000)
- if (max_try_time < 1){
- assertEquals(1,2)
- }
+ return true;
}
- }
+ return false;
+ });
+
sql """sync"""
qt_sql """select * from ${tbName} ORDER BY `decimalv3k1`;"""
do_compact(tbName)
sql """sync"""
qt_sql """select * from ${tbName} ORDER BY `decimalv3k1`;"""
sql """ alter table ${tbName} drop column `decimalv3v3` """
- max_try_time = 1000
- while (max_try_time--){
+ Awaitility.await().atMost(max_try_secs,
TimeUnit.SECONDS).with().pollDelay(100, TimeUnit.MILLISECONDS).await().until(()
-> {
String result = getJobState(tbName)
if (result == "FINISHED") {
- sleep(3000)
- break
- } else {
- sleep(1000)
- if (max_try_time < 1){
- assertEquals(1,2)
- }
+ return true;
}
- }
+ return false;
+ });
sql """sync"""
qt_sql """select * from ${tbName} ORDER BY `decimalv3k1`;"""
sql """ alter table ${tbName} modify column decimalv3k2 DECIMALV3(19,3)
key """
- max_try_time = 1000
- while (max_try_time--){
+ Awaitility.await().atMost(max_try_secs,
TimeUnit.SECONDS).with().pollDelay(100, TimeUnit.MILLISECONDS).await().until(()
-> {
String result = getJobState(tbName)
if (result == "CANCELLED") {
- sleep(3000)
- break
- } else {
- sleep(1000)
- if (max_try_time < 1){
- assertEquals(1,2)
- }
+ return true;
}
- }
+ return false;
+ });
+
sql """sync"""
qt_sql """select * from ${tbName} ORDER BY `decimalv3k1`;"""
sql """ alter table ${tbName} modify column decimalv3k2 DECIMALV3(38,10)
key """
- max_try_time = 1000
- while (max_try_time--){
+ Awaitility.await().atMost(max_try_secs,
TimeUnit.SECONDS).with().pollDelay(100, TimeUnit.MILLISECONDS).await().until(()
-> {
String result = getJobState(tbName)
if (result == "CANCELLED") {
- sleep(3000)
- break
- } else {
- sleep(1000)
- if (max_try_time < 1){
- assertEquals(1,2)
- }
+ return true;
}
- }
+ return false;
+ });
sql """sync"""
qt_sql """select * from ${tbName} ORDER BY `decimalv3k1`;"""
sql """ alter table ${tbName} modify column decimalv3k2 DECIMALV3(16,3)
key """
- max_try_time = 1000
- while (max_try_time--){
+ Awaitility.await().atMost(max_try_secs,
TimeUnit.SECONDS).with().pollDelay(100, TimeUnit.MILLISECONDS).await().until(()
-> {
String result = getJobState(tbName)
if (result == "CANCELLED") {
- sleep(3000)
- break
- } else {
- sleep(1000)
- if (max_try_time < 1){
- assertEquals(1,2)
- }
+ return true;
}
- }
+ return false;
+ });
sql """sync"""
qt_sql """select * from ${tbName} ORDER BY `decimalv3k1`;"""
diff --git
a/regression-test/suites/schema_change_p0/test_varchar_schema_change.groovy
b/regression-test/suites/schema_change_p0/test_varchar_schema_change.groovy
index 38bd996e89d..e4006e6e62b 100644
--- a/regression-test/suites/schema_change_p0/test_varchar_schema_change.groovy
+++ b/regression-test/suites/schema_change_p0/test_varchar_schema_change.groovy
@@ -16,6 +16,8 @@
// under the License.
import org.codehaus.groovy.runtime.IOGroovyMethods
+import java.util.concurrent.TimeUnit
+import org.awaitility.Awaitility
suite ("test_varchar_schema_change") {
def getJobState = { tableName ->
@@ -63,19 +65,14 @@ suite ("test_varchar_schema_change") {
// }
sql """ alter table ${tableName} modify column c2 varchar(30) """
-
- int max_try_time = 1200
- while (max_try_time--){
+ int max_try_secs = 300
+ Awaitility.await().atMost(max_try_secs,
TimeUnit.SECONDS).with().pollDelay(100, TimeUnit.MILLISECONDS).await().until(()
-> {
String result = getJobState(tableName)
if (result == "FINISHED") {
- break
- } else {
- sleep(100)
- if (max_try_time < 1){
- assertEquals(1,2)
- }
+ return true;
}
- }
+ return false;
+ });
String[][] res = sql """ desc ${tableName} """
logger.info(res[2][1])
@@ -92,19 +89,14 @@ suite ("test_varchar_schema_change") {
sql """ insert into ${tableName} values(55,'2019-11-21',21474,'123aa')
"""
sql """ alter table ${tableName} modify column c2 INT """
- max_try_time = 1200
- while (max_try_time--){
+ Awaitility.await().atMost(max_try_secs,
TimeUnit.SECONDS).with().pollDelay(100, TimeUnit.MILLISECONDS).await().until(()
-> {
String result = getJobState(tableName)
if (result == "CANCELLED" || result == "FINISHED") {
assertEquals(result, "CANCELLED")
- break
- } else {
- sleep(100)
- if (max_try_time < 1){
- assertEquals(1,2)
- }
+ return true;
}
- }
+ return false;
+ });
res = sql """ desc ${tableName} """
logger.info(res[2][1])
@@ -127,9 +119,7 @@ suite ("test_varchar_schema_change") {
// wait for all compactions done
for (String[] tablet in tablets) {
- boolean running = true
- do {
- Thread.sleep(100)
+ Awaitility.await().untilAsserted(() -> {
String tablet_id = tablet[0]
backend_id = tablet[2]
(code, out, err) =
be_get_compaction_status(backendId_to_backendIP.get(backend_id),
backendId_to_backendHttpPort.get(backend_id), tablet_id)
@@ -137,8 +127,8 @@ suite ("test_varchar_schema_change") {
assertEquals(code, 0)
def compactionStatus = parseJson(out.trim())
assertEquals("success",
compactionStatus.status.toLowerCase())
- running = compactionStatus.run_status
- } while (running)
+ return compactionStatus.run_status;
+ });
}
qt_sc " select * from ${tableName} order by 1,2; "
@@ -150,18 +140,13 @@ suite ("test_varchar_schema_change") {
modify column c2 varchar(40),
modify column c3 varchar(6) DEFAULT '0'
"""
- max_try_time = 1200
- while (max_try_time--){
+ Awaitility.await().atMost(max_try_secs,
TimeUnit.SECONDS).with().pollDelay(100, TimeUnit.MILLISECONDS).await().until(()
-> {
String result = getJobState(tableName)
if (result == "FINISHED") {
- break
- } else {
- sleep(100)
- if (max_try_time < 1){
- assertEquals(1,2)
- }
+ return true;
}
- }
+ return false;
+ });
res = sql """ desc ${tableName} """
logger.info(res[2][1])
diff --git
a/regression-test/suites/variant_p0/compaction/test_compaction.groovy
b/regression-test/suites/variant_p0/compaction/test_compaction.groovy
index 48d916e38e3..2499de5712d 100644
--- a/regression-test/suites/variant_p0/compaction/test_compaction.groovy
+++ b/regression-test/suites/variant_p0/compaction/test_compaction.groovy
@@ -16,6 +16,7 @@
// under the License.
import org.codehaus.groovy.runtime.IOGroovyMethods
+import org.awaitility.Awaitility
suite("test_compaction_variant") {
try {
@@ -106,9 +107,7 @@ suite("test_compaction_variant") {
// wait for all compactions done
for (def tablet in tablets) {
- boolean running = true
- do {
- Thread.sleep(1000)
+ Awaitility.await().untilAsserted(() -> {
String tablet_id = tablet.TabletId
backend_id = tablet.BackendId
(code, out, err) =
be_get_compaction_status(backendId_to_backendIP.get(backend_id),
backendId_to_backendHttpPort.get(backend_id), tablet_id)
@@ -116,8 +115,8 @@ suite("test_compaction_variant") {
assertEquals(code, 0)
def compactionStatus = parseJson(out.trim())
assertEquals("success",
compactionStatus.status.toLowerCase())
- running = compactionStatus.run_status
- } while (running)
+ return compactionStatus.run_status;
+ });
}
int rowCount = 0
diff --git a/regression-test/suites/variant_p0/compaction_sparse_column.groovy
b/regression-test/suites/variant_p0/compaction_sparse_column.groovy
index 57e6e6ef963..0a7ea100373 100644
--- a/regression-test/suites/variant_p0/compaction_sparse_column.groovy
+++ b/regression-test/suites/variant_p0/compaction_sparse_column.groovy
@@ -16,6 +16,7 @@
// under the License.
import org.codehaus.groovy.runtime.IOGroovyMethods
+import org.awaitility.Awaitility
suite("test_compaction_sparse_column", "nonConcurrent") {
def tableName = "test_compaction"
@@ -125,9 +126,7 @@ suite("test_compaction_sparse_column", "nonConcurrent") {
// wait for all compactions done
for (def tablet in tablets) {
- boolean running = true
- do {
- Thread.sleep(1000)
+ Awaitility.await().untilAsserted(() -> {
String tablet_id = tablet.TabletId
backend_id = tablet.BackendId
(code, out, err) =
be_get_compaction_status(backendId_to_backendIP.get(backend_id),
backendId_to_backendHttpPort.get(backend_id), tablet_id)
@@ -135,8 +134,8 @@ suite("test_compaction_sparse_column", "nonConcurrent") {
assertEquals(code, 0)
def compactionStatus = parseJson(out.trim())
assertEquals("success", compactionStatus.status.toLowerCase())
- running = compactionStatus.run_status
- } while (running)
+ return compactionStatus.run_status;
+ });
}
int rowCount = 0
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]