Skip to content

Commit

Permalink
Add a new mode in tck to execute a query and retry in on failure. Hav…
Browse files Browse the repository at this point in the history
…e applied in some tck cases. (#4612)

Co-authored-by: jimingquan <[email protected]>
Co-authored-by: Sophie <[email protected]>
  • Loading branch information
3 people authored Sep 6, 2022
1 parent 0a060ff commit af570f6
Show file tree
Hide file tree
Showing 7 changed files with 37 additions and 22 deletions.
15 changes: 15 additions & 0 deletions tests/tck/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -405,6 +405,21 @@ def executing_query(query, exec_ctx, request):
ngql = combine_query(query)
exec_query(request, ngql, exec_ctx)

@when(parse("executing query and retrying it on failure every {secs:d} seconds for {retryTimes:d} times:\n{query}"))
def executing_query_with_retry(query, exec_ctx, request, secs, retryTimes):
ngql = combine_query(query)
exec_query(request, ngql, exec_ctx)
res = exec_ctx["result_set"]
if not res.is_succeeded():
retryCounter = 0
while retryCounter < retryTimes:
time.sleep(secs)
exec_query(request, ngql, exec_ctx)
resRetry = exec_ctx["result_set"]
if not resRetry.is_succeeded():
retryCounter = retryCounter + 1
else:
break

@when(parse("executing query with user {username} with password {password}:\n{query}"))
def executing_query(
Expand Down
4 changes: 2 additions & 2 deletions tests/tck/features/delete/DeleteVertexWithoutEdge.feature
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ Feature: delete vertex without edge
CREATE EDGE e();
"""
And wait 6 seconds
When executing query:
When executing query and retrying it on failure every 6 seconds for 9 times:
"""
INSERT VERTEX t(id) VALUES 1:(1),2:(2),3:(3);
INSERT EDGE e() VALUES 1->2:(),1->3:();
Expand Down Expand Up @@ -74,7 +74,7 @@ Feature: delete vertex without edge
CREATE EDGE e();
"""
And wait 6 seconds
When executing query:
When executing query and retrying it on failure every 6 seconds for 3 times:
"""
INSERT VERTEX t(id) VALUES 1:(1),2:(2),3:(2);
INSERT EDGE e() VALUES 1->2:(),1->3:();
Expand Down
8 changes: 4 additions & 4 deletions tests/tck/features/geo/GeoBase.feature
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ Feature: Geo base
"""
Then the execution should be successful
And wait 3 seconds
When executing query:
When executing query and retrying it on failure every 6 seconds for 3 times:
"""
INSERT VERTEX test_1() VALUES "test_101":()
"""
Expand Down Expand Up @@ -245,7 +245,7 @@ Feature: Geo base
Then the execution should be successful
And wait 3 seconds
# Show create tag index
When executing query:
When executing query and retrying it on failure every 6 seconds for 3 times:
"""
SHOW CREATE TAG INDEX any_shape_geo_index;
"""
Expand Down Expand Up @@ -741,7 +741,7 @@ Feature: Geo base
"""
Then the execution should be successful
And wait 3 seconds
When executing query:
When executing query and retrying it on failure every 6 seconds for 3 times:
"""
LOOKUP ON any_shape YIELD id(vertex) as id;
"""
Expand All @@ -753,7 +753,7 @@ Feature: Geo base
"""
Then the execution should be successful
And wait 3 seconds
When executing query:
When executing query and retrying it on failure every 6 seconds for 3 times:
"""
LOOKUP ON any_shape_edge YIELD edge as e;
"""
Expand Down
6 changes: 3 additions & 3 deletions tests/tck/features/index/Index.feature
Original file line number Diff line number Diff line change
Expand Up @@ -839,7 +839,7 @@ Feature: IndexTest_Vid_String
CREATE EDGE INDEX name_edge_index ON name_edge(name(10));
"""
Then the execution should be successful
And wait 6 seconds
And wait 12 seconds
When submit a job:
"""
REBUILD EDGE INDEX;
Expand Down Expand Up @@ -1000,7 +1000,7 @@ Feature: IndexTest_Vid_String
CREATE TAG student(name string, age int);
"""
And wait 6 seconds
When executing query:
When executing query and retrying it on failure every 6 seconds for 3 times:
"""
INSERT VERTEX
student(name, age)
Expand All @@ -1021,7 +1021,7 @@ Feature: IndexTest_Vid_String
"""
Then the execution should be successful
And wait 6 seconds
When executing query:
When executing query and retrying it on failure every 6 seconds for 3 times:
"""
CREATE TAG INDEX student_name_teacher ON student(name(10), teacher(10))
"""
Expand Down
2 changes: 1 addition & 1 deletion tests/tck/features/insert/insertVertexOnly.feature
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Feature: insert vertex without tag
CREATE EDGE e();
"""
And wait 6 seconds
When executing query:
When executing query and retrying it on failure every 6 seconds for 3 times:
"""
INSERT VERTEX VALUES 1:(),2:(),3:();
INSERT EDGE e() VALUES 1->2:(),2->3:();
Expand Down
22 changes: 11 additions & 11 deletions tests/tck/features/lookup/LookUp.feature
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ Feature: LookUpTest_Vid_String
CREATE TAG INDEX t_index_5 ON lookup_tag_2(col4);
"""
And wait 6 seconds
When executing query:
When executing query and retrying it on failure every 6 seconds for 3 times:
"""
INSERT VERTEX
lookup_tag_1(col1, col2, col3)
Expand Down Expand Up @@ -55,7 +55,7 @@ Feature: LookUpTest_Vid_String
CREATE EDGE INDEX e_index_4 ON lookup_edge_2(col3, col4);
"""
And wait 6 seconds
When executing query:
When executing query and retrying it on failure every 6 seconds for 3 times:
"""
INSERT EDGE
lookup_edge_1(col1, col2, col3)
Expand Down Expand Up @@ -94,7 +94,7 @@ Feature: LookUpTest_Vid_String
CREATE TAG INDEX t_index_5 ON lookup_tag_2(col4);
"""
And wait 6 seconds
When executing query:
When executing query and retrying it on failure every 6 seconds for 3 times:
"""
INSERT VERTEX
lookup_tag_2(col1, col2, col3, col4)
Expand Down Expand Up @@ -244,7 +244,7 @@ Feature: LookUpTest_Vid_String
CREATE EDGE INDEX e_index_4 ON lookup_edge_2(col3, col4);
"""
And wait 6 seconds
When executing query:
When executing query and retrying it on failure every 6 seconds for 3 times:
"""
INSERT EDGE
lookup_edge_2(col1, col2, col3, col4)
Expand Down Expand Up @@ -389,7 +389,7 @@ Feature: LookUpTest_Vid_String
CREATE TAG INDEX t_index_5 ON lookup_tag_2(col4);
"""
And wait 6 seconds
When executing query:
When executing query and retrying it on failure every 6 seconds for 3 times:
"""
INSERT VERTEX
lookup_tag_2(col1, col2, col3, col4)
Expand Down Expand Up @@ -518,7 +518,7 @@ Feature: LookUpTest_Vid_String
CREATE TAG teacher(number int, age int)
"""
And wait 6 seconds
When executing query:
When executing query and retrying it on failure every 6 seconds for 3 times:
"""
INSERT VERTEX student(number, age), teacher(number, age) VALUES "220":(1, 20, 1, 30), "221":(2, 22, 2, 32)
"""
Expand Down Expand Up @@ -573,7 +573,7 @@ Feature: LookUpTest_Vid_String
CREATE TAG INDEX i5 ON t1(c1, c2, c3, c5)
"""
And wait 6 seconds
When executing query:
When executing query and retrying it on failure every 6 seconds for 3 times:
"""
LOOKUP ON t1 WHERE t1.c1 == 1 YIELD vertex as node
"""
Expand Down Expand Up @@ -651,7 +651,7 @@ Feature: LookUpTest_Vid_String
CREATE TAG INDEX i5_str ON t1_str(c1, c2, c3(30), c4(30))
"""
And wait 6 seconds
When executing query:
When executing query and retrying it on failure every 6 seconds for 3 times:
"""
LOOKUP ON t1_str WHERE t1_str.c1 == 1 YIELD t1_str.c1
"""
Expand Down Expand Up @@ -711,7 +711,7 @@ Feature: LookUpTest_Vid_String
CREATE TAG INDEX i3_with_str ON tag_with_str(c1, c2(30), c3(30))
"""
And wait 6 seconds
When executing query:
When executing query and retrying it on failure every 6 seconds for 3 times:
"""
INSERT VERTEX
tag_with_str(c1, c2, c3)
Expand Down Expand Up @@ -781,7 +781,7 @@ Feature: LookUpTest_Vid_String
identity(BIRTHDAY, NATION(30), BIRTHPLACE_CITY(30))
"""
And wait 6 seconds
When executing query:
When executing query and retrying it on failure every 6 seconds for 3 times:
"""
INSERT VERTEX identity(BIRTHDAY, NATION, BIRTHPLACE_CITY) VALUES "1" : (19860413, "汉族", "aaa")
"""
Expand Down Expand Up @@ -973,7 +973,7 @@ Feature: LookUpTest_Vid_String
CREATE TAG player(name string, age int);
"""
And wait 6 seconds
When executing query:
When executing query and retrying it on failure every 6 seconds for 3 times:
"""
INSERT VERTEX player(name, age) VALUES 'Tim':('Tim', 20);
"""
Expand Down
2 changes: 1 addition & 1 deletion tests/tck/features/lookup/LookupTag2.feature
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ Feature: Test lookup on tag index 2
Then drop the used space

Scenario Outline: [tag] scan without hints
When executing query:
When executing query and retrying it on failure every 6 seconds for 3 times:
"""
LOOKUP ON
lookup_tag_1
Expand Down

0 comments on commit af570f6

Please sign in to comment.