Skip to content

Commit

Permalink
add more testcase
Browse files Browse the repository at this point in the history
  • Loading branch information
nevermore3 committed Jan 5, 2022
1 parent 6ada93b commit a7defe7
Show file tree
Hide file tree
Showing 2 changed files with 146 additions and 9 deletions.
138 changes: 137 additions & 1 deletion tests/tck/features/insert/InsertIfNotExists.feature
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ Feature: Insert vertex and edge with if not exists
| 200 |
And drop the used space

Scenario: index and data consistency check
Scenario: vertices index and data consistency check
Given an empty graph
And create a space with following options:
| partition_num | 9 |
Expand Down Expand Up @@ -404,3 +404,139 @@ Feature: Insert vertex and edge with if not exists
| "sun" | 16 |
| "chen" | 40 |
And drop the used space

Scenario: edge index and data consistency check
Given an empty graph
And create a space with following options:
| partition_num | 9 |
| replica_factor | 1 |
| vid_type | FIXED_STRING(20) |
And having executed:
"""
CREATE TAG IF NOT EXISTS student(name string, age int);
CREATE EDGE IF NOT EXISTS like(likeness int, t1 int);
CREATE EDGE INDEX index_l_likeness on like(likeness);
"""
And wait 6 seconds
When try to execute query:
"""
INSERT VERTEX
student(name, age)
VALUES
"zhang":("zhang", 19),
"wang":("wang", 18),
"li":("li", 16);
INSERT EDGE
like(likeness, t1)
VALUES
"zhang"->"wang":(19, 19),
"zhang"->"li":(42, 42),
"zhang"->"li":(20, 20),
"zhang"->"wang":(39, 39),
"wang"->"li":(18, 18),
"wang"->"zhang":(41, 41);
"""
Then the execution should be successful
When executing query:
"""
LOOKUP ON like WHERE like.likeness < 30 YIELD src(edge) as src, dst(edge) as dst, like.likeness as likeness
"""
Then the result should be, in any order, with relax comparison:
| src | dst | likeness |
| "zhang" | "li" | 20 |
| "wang" | "li" | 18 |
When executing query:
"""
LOOKUP ON like WHERE like.likeness > 30 YIELD src(edge) as src, dst(edge) as dst, like.likeness as likeness
"""
Then the result should be, in any order, with relax comparison:
| src | dst | likeness |
| "zhang" | "wang" | 39 |
| "wang" | "zhang" | 41 |
When executing query:
"""
LOOKUP ON like WHERE like.likeness < 30 YIELD src(edge) as src, dst(edge) as dst, like.likeness as likeness, like.t1 as t1
"""
Then the result should be, in any order, with relax comparison:
| src | dst | likeness | t1 |
| "zhang" | "li" | 20 | 20 |
| "wang" | "li" | 18 | 18 |
When executing query:
"""
LOOKUP ON like WHERE like.likeness > 30 YIELD src(edge) as src, dst(edge) as dst, like.likeness as likeness, like.t1 as t1
"""
Then the result should be, in any order, with relax comparison:
| src | dst | likeness | t1 |
| "zhang" | "wang" | 39 | 39 |
| "wang" | "zhang" | 41 | 41 |
When executing query:
"""
FETCH PROP ON like "zhang"->"wang", "zhang"->"li", "wang"->"li", "wang"->"zhang" YIELD src(edge) as src, dst(edge) as dst, like.likeness as likeness
"""
Then the result should be, in any order, with relax comparison:
| src | dst | likeness |
| "zhang" | "wang" | 39 |
| "zhang" | "li" | 20 |
| "wang" | "li" | 18 |
| "wang" | "zhang" | 41 |
When try to execute query:
"""
DELETE EDGE like "zhang"->"wang", "zhang"->"li", "wang"->"li", "wang"->"zhang";
"""
Then the execution should be successful
When try to execute query:
"""
INSERT EDGE IF NOT EXISTS
like(likeness, t1)
VALUES
"zhang"->"wang":(19, 19),
"zhang"->"li":(42, 42),
"zhang"->"li":(20, 20),
"zhang"->"wang":(39, 39),
"wang"->"li":(18, 18),
"wang"->"zhang":(41, 41);
"""
Then the execution should be successful
When executing query:
"""
LOOKUP ON like WHERE like.likeness < 30 YIELD src(edge) as src, dst(edge) as dst, like.likeness as likeness
"""
Then the result should be, in any order, with relax comparison:
| src | dst | likeness |
| "zhang" | "wang" | 19 |
| "wang" | "li" | 18 |
When executing query:
"""
LOOKUP ON like WHERE like.likeness > 30 YIELD src(edge) as src, dst(edge) as dst, like.likeness as likeness
"""
Then the result should be, in any order, with relax comparison:
| src | dst | likeness |
| "zhang" | "li" | 42 |
| "wang" | "zhang" | 41 |
When executing query:
"""
LOOKUP ON like WHERE like.likeness < 30 YIELD src(edge) as src, dst(edge) as dst, like.likeness as likeness, like.t1 as t1
"""
Then the result should be, in any order, with relax comparison:
| src | dst | likeness | t1 |
| "zhang" | "wang" | 19 | 19 |
| "wang" | "li" | 18 | 18 |
When executing query:
"""
LOOKUP ON like WHERE like.likeness > 30 YIELD src(edge) as src, dst(edge) as dst, like.likeness as likeness, like.t1 as t1
"""
Then the result should be, in any order, with relax comparison:
| src | dst | likeness | t1 |
| "zhang" | "li" | 42 | 42 |
| "wang" | "zhang" | 41 | 41 |
When executing query:
"""
FETCH PROP ON like "zhang"->"wang", "zhang"->"li", "wang"->"li", "wang"->"zhang" YIELD src(edge) as src, dst(edge) as dst, like.likeness as likeness
"""
Then the result should be, in any order, with relax comparison:
| src | dst | likeness |
| "zhang" | "wang" | 19 |
| "zhang" | "li" | 42 |
| "wang" | "li" | 18 |
| "wang" | "zhang" | 41 |
And drop the used space
17 changes: 9 additions & 8 deletions tests/tck/features/lookup/LookUp.feature
Original file line number Diff line number Diff line change
Expand Up @@ -842,15 +842,16 @@ Feature: LookUpTest_Vid_String
"104":("yyy", 28),
"105":("zzz", 21),
"106":("kkk", 21),
"121":("Useless", 60),
"121":("Useless", 20);
INSERT VERTEX
team(name)
VALUES
"200":("Warriors"),
"201":("Nuggets"),
"202":("oopp"),
"203":("iiiooo"),
"204":("opl");
INSERT VERTEX
team(name)
VALUES
"200":("Warriors"),
"201":("Nuggets"),
"202":("oopp"),
"203":("iiiooo"),
"204":("opl");
"""
When executing query:
"""
Expand Down

0 comments on commit a7defe7

Please sign in to comment.