Skip to content

Commit 2d30a7e

Browse files
authored
fix: reduce CI error rate of test_private_task (#18473)
* fix: By extending the task time unit by 5 times, the hardware weakness can easily lead to CI failure. * chore: fix test * chore: fix test
1 parent 958b862 commit 2d30a7e

File tree

2 files changed

+25
-35
lines changed

2 files changed

+25
-35
lines changed

tests/task/test-private-task-warehouse.sh

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -19,46 +19,38 @@ echo "Starting Databend Query cluster enable private task"
1919
./scripts/ci/deploy/databend-query-system-managed.sh 2
2020

2121
response=$(curl -s -u root: -XPOST "http://localhost:8000/v1/query" -H 'Content-Type: application/json' -d "{\"sql\": \"CREATE WAREHOUSE wh1 WITH WAREHOUSE_SIZE = '1'\"}")
22-
echo $response
2322
create_warehouse_1_query_id=$(echo $response | jq -r '.id')
2423
echo "Create WareHouse 1 Query ID: $create_warehouse_1_query_id"
2524

2625
response=$(curl -s -u root: -XPOST "http://localhost:8000/v1/query" -H 'Content-Type: application/json' -d "{\"sql\": \"CREATE WAREHOUSE wh2 WITH WAREHOUSE_SIZE = '1'\"}")
27-
echo $response
2826
create_warehouse_2_query_id=$(echo $response | jq -r '.id')
2927
echo "Create WareHouse 2 Query ID: $create_warehouse_2_query_id"
3028

3129
response=$(curl -s -u root: -XPOST "http://localhost:8000/v1/query" -H 'Content-Type: application/json' -d "{\"sql\": \"CREATE TABLE t1 (c1 int)\"}")
32-
echo $response
3330
create_table_query_id=$(echo $response | jq -r '.id')
3431
echo "Create Table Query ID: $create_table_query_id"
3532

36-
response=$(curl -s -u root: -XPOST "http://localhost:8000/v1/query" -H 'Content-Type: application/json' -d "{\"sql\": \"CREATE TASK my_task_1 WAREHOUSE = 'wh1' SCHEDULE = 3 SECOND AS insert into t1 values(1)\"}")
37-
echo $response
33+
response=$(curl -s -u root: -XPOST "http://localhost:8000/v1/query" -H 'Content-Type: application/json' -d "{\"sql\": \"CREATE TASK my_task_1 WAREHOUSE = 'wh1' SCHEDULE = 15 SECOND AS insert into t1 values(1)\"}")
3834
create_task_1_query_id=$(echo $response | jq -r '.id')
3935
echo "Create Task 1 Query ID: $create_task_1_query_id"
4036

41-
response=$(curl -s -u root: -XPOST "http://localhost:8000/v1/query" -H 'Content-Type: application/json' -d "{\"sql\": \"CREATE TASK my_task_2 WAREHOUSE = 'wh2' SCHEDULE = 3 SECOND AS insert into t1 values(2)\"}")
42-
echo $response
37+
response=$(curl -s -u root: -XPOST "http://localhost:8000/v1/query" -H 'Content-Type: application/json' -d "{\"sql\": \"CREATE TASK my_task_2 WAREHOUSE = 'wh2' SCHEDULE = 15 SECOND AS insert into t1 values(2)\"}")
4338
create_task_2_query_id=$(echo $response | jq -r '.id')
4439
echo "Create Task 2 ID: $create_task_2_query_id"
4540

46-
sleep 2
41+
sleep 10
4742

4843
response=$(curl -s -u root: -XPOST "http://localhost:8000/v1/query" -H 'Content-Type: application/json' -d "{\"sql\": \"ALTER TASK my_task_1 RESUME\"}")
49-
echo $response
5044
resume_task_1_query_id=$(echo $response | jq -r '.id')
5145
echo "RESUME Task 1 ID: $resume_task_1_query_id"
5246

5347
response=$(curl -s -u root: -XPOST "http://localhost:8000/v1/query" -H 'Content-Type: application/json' -d "{\"sql\": \"ALTER TASK my_task_2 RESUME\"}")
54-
echo $response
5548
resume_task_2_query_id=$(echo $response | jq -r '.id')
5649
echo "RESUME Task 2 ID: $resume_task_2_query_id"
5750

58-
sleep 5
51+
sleep 25
5952

6053
response=$(curl -s -u root: -XPOST "http://localhost:8000/v1/query" -H 'Content-Type: application/json' -d "{\"sql\": \"SELECT c1 FROM t1 ORDER BY c1\"}")
61-
echo $response
6254

6355
actual=$(echo "$response" | jq -c '.data')
6456
expected='[["1"],["2"]]'
@@ -73,14 +65,12 @@ else
7365
fi
7466

7567
response=$(curl -s -u root: -XPOST "http://localhost:8000/v1/query" -H 'Content-Type: application/json' -d "{\"sql\": \"SUSPEND WAREHOUSE wh2\"}")
76-
echo $response
7768
suspend_warehouse_2_query_id=$(echo $response | jq -r '.id')
7869
echo "Suspend WareHouse 2 Query ID: $suspend_warehouse_2_query_id"
7970

80-
sleep 4
71+
sleep 20
8172

8273
response=$(curl -s -u root: -XPOST "http://localhost:8000/v1/query" -H 'X-DATABEND-WAREHOUSE: wh1' -H 'Content-Type: application/json' -d "{\"sql\": \"SELECT c1 FROM t1 ORDER BY c1\"}")
83-
echo $response
8474

8575
actual=$(echo "$response" | jq -c '.data')
8676
expected='[["1"],["1"],["2"]]'

tests/task/test-private-task.sh

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -61,25 +61,25 @@ response=$(curl -s -u root: -XPOST "http://localhost:8000/v1/query" -H 'Content-
6161
create_table_query_id=$(echo $response | jq -r '.id')
6262
echo "Create Table Query ID: $create_table_query_id"
6363

64-
response1=$(curl -s -u root: -XPOST "http://localhost:8000/v1/query" -H 'Content-Type: application/json' -d "{\"sql\": \"CREATE TASK my_task_1 SCHEDULE = 1 SECOND AS insert into t1 values(0)\"}")
64+
response1=$(curl -s -u root: -XPOST "http://localhost:8000/v1/query" -H 'Content-Type: application/json' -d "{\"sql\": \"CREATE TASK my_task_1 SCHEDULE = 5 SECOND AS insert into t1 values(0)\"}")
6565
create_task_1_query_id=$(echo $response1 | jq -r '.id')
6666
echo "Create Task 1 Query ID: $create_task_1_query_id"
6767

68-
response2=$(curl -s -u root: -XPOST "http://localhost:8000/v1/query" -H 'Content-Type: application/json' -d "{\"sql\": \"CREATE TASK my_task_2 SCHEDULE = 5 SECOND AS insert into t1 values(1)\"}")
68+
response2=$(curl -s -u root: -XPOST "http://localhost:8000/v1/query" -H 'Content-Type: application/json' -d "{\"sql\": \"CREATE TASK my_task_2 SCHEDULE = 25 SECOND AS insert into t1 values(1)\"}")
6969
create_task_2_query_id=$(echo $response2 | jq -r '.id')
7070
echo "Create Task 2 ID: $create_task_2_query_id"
7171

7272
response3=$(curl -s -u root: -XPOST "http://localhost:8000/v1/query" -H 'Content-Type: application/json' -d "{\"sql\": \"CREATE TASK my_task_3 AFTER 'my_task_1', 'my_task_2' AS insert into t1 values(2)\"}")
7373
create_task_3_query_id=$(echo $response3 | jq -r '.id')
7474
echo "Create Task 3 ID: $create_task_3_query_id"
7575

76-
sleep 1
76+
sleep 5
7777

7878
response4=$(curl -s -u root: -XPOST "http://localhost:8000/v1/query" -H 'Content-Type: application/json' -d "{\"sql\": \"ALTER TASK my_task_3 RESUME\"}")
7979
alter_task_3_query_id=$(echo $response4 | jq -r '.id')
8080
echo "Resume Task 3 ID: $alter_task_3_query_id"
8181

82-
sleep 1
82+
sleep 5
8383

8484
# Check Task Afters 1
8585

@@ -91,7 +91,7 @@ response6=$(curl -s -u root: -XPOST "http://localhost:8000/v1/query" -H 'Content
9191
execute_task_2_query_id=$(echo $response6 | jq -r '.id')
9292
echo "Execute Task 2 ID: $execute_task_2_query_id"
9393

94-
sleep 5
94+
sleep 25
9595

9696
response7=$(curl -s -u root: -XPOST "http://localhost:8000/v1/query" -H 'Content-Type: application/json' -d "{\"sql\": \"SELECT c1 FROM t1 ORDER BY c1\"}")
9797

@@ -113,7 +113,7 @@ response5=$(curl -s -u root: -XPOST "http://localhost:8000/v1/query" -H 'Content
113113
execute_task_1_query_id=$(echo $response5 | jq -r '.id')
114114
echo "Execute Task 1 ID: $execute_task_1_query_id"
115115

116-
sleep 5
116+
sleep 25
117117

118118
response7=$(curl -s -u root: -XPOST "http://localhost:8000/v1/query" -H 'Content-Type: application/json' -d "{\"sql\": \"SELECT c1 FROM t1 ORDER BY c1\"}")
119119

@@ -133,7 +133,7 @@ response8=$(curl -s -u root: -XPOST "http://localhost:8000/v1/query" -H 'Content
133133
alter_task_2_query_id=$(echo $response8 | jq -r '.id')
134134
echo "Resume Task 2 ID: $alter_task_2_query_id"
135135

136-
sleep 8
136+
sleep 40
137137

138138
response9=$(curl -s -u root: -XPOST "http://localhost:8000/v1/query" -H 'Content-Type: application/json' -d "{\"sql\": \"SELECT c1 FROM t1 ORDER BY c1\"}")
139139

@@ -167,7 +167,7 @@ python3 scripts/ci/wait_tcp.py --timeout 30 --port 9092
167167

168168
echo "Started 2-node cluster with private task enabled..."
169169

170-
sleep 9
170+
sleep 45
171171

172172
response9=$(curl -s -u root: -XPOST "http://localhost:8000/v1/query" -H 'Content-Type: application/json' -d "{\"sql\": \"SELECT c1 FROM t1 ORDER BY c1\"}")
173173

@@ -234,22 +234,22 @@ response15=$(curl -s -u root: -XPOST "http://localhost:8000/v1/query" -H 'Conten
234234
create_table_query_id_1=$(echo $response15 | jq -r '.id')
235235
echo "Create Table Query ID: $create_table_query_id_1"
236236

237-
response16=$(curl -s -u root: -XPOST "http://localhost:8000/v1/query" -H 'Content-Type: application/json' -d "{\"sql\": \"CREATE TASK my_task_4 SCHEDULE = USING CRON '*/5 * * * * ?' AS insert into t2 values(0)\"}")
237+
response16=$(curl -s -u root: -XPOST "http://localhost:8000/v1/query" -H 'Content-Type: application/json' -d "{\"sql\": \"CREATE TASK my_task_4 SCHEDULE = USING CRON '*/25 * * * * *' AS insert into t2 values(0)\"}")
238238
create_task_4_query_id=$(echo $response16 | jq -r '.id')
239239
echo "Create Task 4 Query ID: $create_task_4_query_id"
240240

241-
sleep 1
241+
sleep 5
242242

243243
response17=$(curl -s -u root: -XPOST "http://localhost:8000/v1/query" -H 'Content-Type: application/json' -d "{\"sql\": \"ALTER TASK my_task_4 RESUME\"}")
244244
alter_task_4_query_id=$(echo $response17 | jq -r '.id')
245245
echo "Resume Task 4 ID: $alter_task_4_query_id"
246246

247-
sleep 11
247+
sleep 60
248248

249249
response18=$(curl -s -u root: -XPOST "http://localhost:8000/v1/query" -H 'Content-Type: application/json' -d "{\"sql\": \"SELECT c1 FROM t2 ORDER BY c1\"}")
250250

251251
actual=$(echo "$response18" | jq -c '.data')
252-
expected='[["0"],["0"]]'
252+
expected='[["0"],["0"],["0"]]'
253253

254254
if [ "$actual" = "$expected" ]; then
255255
echo "✅ Query result matches expected"
@@ -274,19 +274,19 @@ response20=$(curl -s -u root: -XPOST "http://localhost:8000/v1/query" -H 'Conten
274274
create_table_query_id_2=$(echo $response20 | jq -r '.id')
275275
echo "Create Table Query ID: $create_table_query_id_2"
276276

277-
response21=$(curl -s -u root: -XPOST "http://localhost:8000/v1/query" -H 'Content-Type: application/json' -d "{\"sql\": \"CREATE TASK my_task_5 SCHEDULE = 3 SECOND WHEN EXISTS (SELECT 1 FROM t3 WHERE c2 = 1) AS insert into t3 values(1, 0)\"}")
277+
response21=$(curl -s -u root: -XPOST "http://localhost:8000/v1/query" -H 'Content-Type: application/json' -d "{\"sql\": \"CREATE TASK my_task_5 SCHEDULE = 25 SECOND WHEN EXISTS (SELECT 1 FROM t3 WHERE c2 = 1) AS insert into t3 values(1, 0)\"}")
278278
create_task_5_query_id=$(echo $response21 | jq -r '.id')
279279
echo "Create Task 5 Query ID: $create_task_5_query_id"
280280

281-
response22=$(curl -s -u root: -XPOST "http://localhost:8000/v1/query" -H 'Content-Type: application/json' -d "{\"sql\": \"CREATE TASK my_task_6 SCHEDULE = 5 SECOND WHEN EXISTS (SELECT 1 FROM t3 WHERE c2 = 1) AS insert into t3 values(2, 0)\"}")
281+
response22=$(curl -s -u root: -XPOST "http://localhost:8000/v1/query" -H 'Content-Type: application/json' -d "{\"sql\": \"CREATE TASK my_task_6 SCHEDULE = 25 SECOND WHEN EXISTS (SELECT 1 FROM t3 WHERE c2 = 1) AS insert into t3 values(2, 0)\"}")
282282
create_task_6_query_id=$(echo $response22 | jq -r '.id')
283283
echo "Create Task 6 Query ID: $create_task_6_query_id"
284284

285285
response23=$(curl -s -u root: -XPOST "http://localhost:8000/v1/query" -H 'Content-Type: application/json' -d "{\"sql\": \"CREATE TASK my_task_7 AFTER 'my_task_5', 'my_task_6' WHEN EXISTS (SELECT 1 FROM t3 WHERE c2 = 2) AS insert into t3 values(3, 0)\"}")
286286
create_task_7_query_id=$(echo $response23 | jq -r '.id')
287287
echo "Create Task 7 Query ID: $create_task_7_query_id"
288288

289-
sleep 1
289+
sleep 5
290290

291291
response24=$(curl -s -u root: -XPOST "http://localhost:8000/v1/query" -H 'Content-Type: application/json' -d "{\"sql\": \"ALTER TASK my_task_5 RESUME\"}")
292292
alter_task_5_query_id=$(echo $response24 | jq -r '.id')
@@ -300,7 +300,7 @@ response26=$(curl -s -u root: -XPOST "http://localhost:8000/v1/query" -H 'Conten
300300
alter_task_7_query_id=$(echo $response26 | jq -r '.id')
301301
echo "Resume Task 7 ID: $alter_task_7_query_id"
302302

303-
sleep 6
303+
sleep 30
304304

305305
response27=$(curl -s -u root: -XPOST "http://localhost:8000/v1/query" -H 'Content-Type: application/json' -d "{\"sql\": \"SELECT c1 FROM t3 ORDER BY c1\"}")
306306

@@ -320,7 +320,7 @@ response28=$(curl -s -u root: -XPOST "http://localhost:8000/v1/query" -H 'Conten
320320
insert_t3_query_id=$(echo $response28 | jq -r '.id')
321321
echo "INSERT T3 (1, 1) ID: $insert_t3_query_id"
322322

323-
sleep 5
323+
sleep 25
324324

325325
response29=$(curl -s -u root: -XPOST "http://localhost:8000/v1/query" -H 'Content-Type: application/json' -d "{\"sql\": \"SELECT c1, c2 FROM t3 ORDER BY c1, c2\"}")
326326

@@ -340,7 +340,7 @@ response30=$(curl -s -u root: -XPOST "http://localhost:8000/v1/query" -H 'Conten
340340
execute_task_7_query_id=$(echo $response30 | jq -r '.id')
341341
echo "Execute Task 7 ID: $execute_task_7_query_id"
342342

343-
sleep 1
343+
sleep 5
344344

345345
response31=$(curl -s -u root: -XPOST "http://localhost:8000/v1/query" -H 'Content-Type: application/json' -d "{\"sql\": \"SELECT c1, c2 FROM t3 ORDER BY c1, c2\"}")
346346

@@ -360,12 +360,12 @@ response32=$(curl -s -u root: -XPOST "http://localhost:8000/v1/query" -H 'Conten
360360
insert_t3_query_id_1=$(echo $response32 | jq -r '.id')
361361
echo "INSERT T3 (2, 2) ID: $insert_t3_query_id_1"
362362

363-
sleep 6
363+
sleep 30
364364

365365
response33=$(curl -s -u root: -XPOST "http://localhost:8000/v1/query" -H 'Content-Type: application/json' -d "{\"sql\": \"SELECT c1, c2 FROM t3 ORDER BY c1, c2\"}")
366366

367367
actual=$(echo "$response33" | jq -c '.data')
368-
expected='[["1","0"],["1","0"],["1","0"],["1","1"],["2","0"],["2","0"],["2","2"],["3","0"],["3","0"],["3","0"]]'
368+
expected='[["1","0"],["1","0"],["1","1"],["2","0"],["2","0"],["2","2"],["3","0"],["3","0"]]'
369369

370370
if [ "$actual" = "$expected" ]; then
371371
echo "✅ Query result matches expected"

0 commit comments

Comments
 (0)