Skip to content

Commit

Permalink
update test to look better
Browse files Browse the repository at this point in the history
fix tck
  • Loading branch information
wenhaocs committed Dec 25, 2022
1 parent a2fcac7 commit f4fdadd
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 25 deletions.
4 changes: 2 additions & 2 deletions src/meta/test/ProcessorTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1454,7 +1454,7 @@ TEST(ProcessorTest, AlterTagTest) {
cpp2::Schema changeSch;
cpp2::ColumnDef column;
column.name = "tag_0_col_10";
column.type.type_ref() = PropertyType::DOUBLE;
column.type.type_ref() = PropertyType::INT64;
(*changeSch.columns_ref()).emplace_back(std::move(column));

items.emplace_back();
Expand Down Expand Up @@ -2042,7 +2042,7 @@ TEST(ProcessorTest, AlterEdgeTest) {
cpp2::Schema changeSch;
cpp2::ColumnDef column;
column.name = "edge_0_col_10";
column.type.type_ref() = PropertyType::DOUBLE;
column.type.type_ref() = PropertyType::INT64;
(*changeSch.columns_ref()).emplace_back(std::move(column));

items.emplace_back();
Expand Down
56 changes: 33 additions & 23 deletions tests/tck/features/ttl/TTL.feature
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ Feature: TTLTest
Then the execution should be successful
When executing query:
"""
CREATE TAG woman(name string, email string, age int, gender string, row_timestamp timestamp) ttl_duration = 0, ttl_col = "row_timestamp";
CREATE TAG woman(name string, email string, age int32, gender string, row_timestamp timestamp) ttl_duration = 0, ttl_col = "row_timestamp";
"""
Then the execution should be successful
When executing query:
Expand All @@ -126,7 +126,7 @@ Feature: TTLTest
"""
Then the result should be, in any order:
| Tag | Create Tag |
| "woman" | 'CREATE TAG `woman` (\n `name` string NULL,\n `email` string NULL,\n `age` int64 NULL,\n `gender` string NULL\n) ttl_duration = 0, ttl_col = ""' |
| "woman" | 'CREATE TAG `woman` (\n `name` string NULL,\n `email` string NULL,\n `age` int32 NULL,\n `gender` string NULL\n) ttl_duration = 0, ttl_col = ""' |
When executing query:
"""
ALTER TAG woman ttl_duration = 100, ttl_col = "age";
Expand All @@ -138,10 +138,10 @@ Feature: TTLTest
"""
Then the result should be, in any order:
| Tag | Create Tag |
| "woman" | 'CREATE TAG `woman` (\n `name` string NULL,\n `email` string NULL,\n `age` int64 NULL,\n `gender` string NULL\n) ttl_duration = 100, ttl_col = "age"' |
| "woman" | 'CREATE TAG `woman` (\n `name` string NULL,\n `email` string NULL,\n `age` int32 NULL,\n `gender` string NULL\n) ttl_duration = 100, ttl_col = "age"' |
When executing query:
"""
ALTER TAG woman CHANGE (age string);
ALTER TAG woman CHANGE (age int64);
"""
Then a ExecutionError should be raised at runtime:
When executing query:
Expand All @@ -155,19 +155,24 @@ Feature: TTLTest
"""
Then the result should be, in any order:
| Tag | Create Tag |
| "woman" | 'CREATE TAG `woman` (\n `name` string NULL,\n `email` string NULL,\n `age` int64 NULL,\n `gender` string NULL\n) ttl_duration = 0, ttl_col = ""' |
| "woman" | 'CREATE TAG `woman` (\n `name` string NULL,\n `email` string NULL,\n `age` int32 NULL,\n `gender` string NULL\n) ttl_duration = 0, ttl_col = ""' |
When executing query:
"""
ALTER TAG woman CHANGE (age string);
ALTER TAG woman CHANGE (age int64);
"""
Then the execution should be successful
When executing query:
"""
ALTER TAG woman CHANGE (age string);
"""
Then a ExecutionError should be raised at runtime:
When executing query:
"""
SHOW CREATE TAG woman;
"""
Then the result should be, in any order:
| Tag | Create Tag |
| "woman" | 'CREATE TAG `woman` (\n `name` string NULL,\n `email` string NULL,\n `age` string NULL,\n `gender` string NULL\n) ttl_duration = 0, ttl_col = ""' |
| "woman" | 'CREATE TAG `woman` (\n `name` string NULL,\n `email` string NULL,\n `age` int64 NULL,\n `gender` string NULL\n) ttl_duration = 0, ttl_col = ""' |
When executing query:
"""
CREATE EDGE work(number string, start_time timestamp);
Expand Down Expand Up @@ -222,7 +227,7 @@ Feature: TTLTest
Then a ExecutionError should be raised at runtime:
When executing query:
"""
CREATE EDGE work2(name string, email string, age int, gender string, start_time timestamp) ttl_duration = 0, ttl_col = "start_time";
CREATE EDGE work2(name string, email string, age int32, gender string, start_time timestamp) ttl_duration = 0, ttl_col = "start_time";
"""
Then the execution should be successful
When executing query:
Expand All @@ -231,7 +236,7 @@ Feature: TTLTest
"""
Then the result should be, in any order:
| Edge | Create Edge |
| "work2" | 'CREATE EDGE `work2` (\n `name` string NULL,\n `email` string NULL,\n `age` int64 NULL,\n `gender` string NULL,\n `start_time` timestamp NULL\n) ttl_duration = 0, ttl_col = "start_time"' |
| "work2" | 'CREATE EDGE `work2` (\n `name` string NULL,\n `email` string NULL,\n `age` int32 NULL,\n `gender` string NULL,\n `start_time` timestamp NULL\n) ttl_duration = 0, ttl_col = "start_time"' |
When executing query:
"""
CREATE EDGE edge_only_ttl_col(name string, email string, age int, gender string, row_timestamp timestamp) ttl_col = "row_timestamp";
Expand All @@ -255,7 +260,7 @@ Feature: TTLTest
"""
Then the result should be, in any order:
| Edge | Create Edge |
| "work2" | 'CREATE EDGE `work2` (\n `name` string NULL,\n `email` string NULL,\n `age` int64 NULL,\n `gender` string NULL,\n `start_time` timestamp NULL\n) ttl_duration = 50, ttl_col = "start_time"' |
| "work2" | 'CREATE EDGE `work2` (\n `name` string NULL,\n `email` string NULL,\n `age` int32 NULL,\n `gender` string NULL,\n `start_time` timestamp NULL\n) ttl_duration = 50, ttl_col = "start_time"' |
When executing query:
"""
ALTER EDGE work2 ttl_col = "name";
Expand All @@ -272,7 +277,7 @@ Feature: TTLTest
"""
Then the result should be, in any order:
| Edge | Create Edge |
| "work2" | 'CREATE EDGE `work2` (\n `email` string NULL,\n `age` int64 NULL,\n `gender` string NULL,\n `start_time` timestamp NULL\n) ttl_duration = 200, ttl_col = "start_time"' |
| "work2" | 'CREATE EDGE `work2` (\n `email` string NULL,\n `age` int32 NULL,\n `gender` string NULL,\n `start_time` timestamp NULL\n) ttl_duration = 200, ttl_col = "start_time"' |
When executing query:
"""
ALTER EDGE work2 Drop (start_time);
Expand All @@ -284,7 +289,7 @@ Feature: TTLTest
"""
Then the result should be, in any order:
| Edge | Create Edge |
| "work2" | 'CREATE EDGE `work2` (\n `email` string NULL,\n `age` int64 NULL,\n `gender` string NULL\n) ttl_duration = 0, ttl_col = ""' |
| "work2" | 'CREATE EDGE `work2` (\n `email` string NULL,\n `age` int32 NULL,\n `gender` string NULL\n) ttl_duration = 0, ttl_col = ""' |
When executing query:
"""
ALTER Edge work2 ttl_duration = 100, ttl_col = "age";
Expand All @@ -296,10 +301,10 @@ Feature: TTLTest
"""
Then the result should be, in any order:
| Edge | Create Edge |
| "work2" | 'CREATE EDGE `work2` (\n `email` string NULL,\n `age` int64 NULL,\n `gender` string NULL\n) ttl_duration = 100, ttl_col = "age"' |
| "work2" | 'CREATE EDGE `work2` (\n `email` string NULL,\n `age` int32 NULL,\n `gender` string NULL\n) ttl_duration = 100, ttl_col = "age"' |
When executing query:
"""
ALTER EDGE work2 CHANGE (age string);
ALTER EDGE work2 CHANGE (age int64);
"""
Then a ExecutionError should be raised at runtime:
When executing query:
Expand All @@ -313,19 +318,24 @@ Feature: TTLTest
"""
Then the result should be, in any order:
| Edge | Create Edge |
| "work2" | 'CREATE EDGE `work2` (\n `email` string NULL,\n `age` int64 NULL,\n `gender` string NULL\n) ttl_duration = 0, ttl_col = ""' |
| "work2" | 'CREATE EDGE `work2` (\n `email` string NULL,\n `age` int32 NULL,\n `gender` string NULL\n) ttl_duration = 0, ttl_col = ""' |
When executing query:
"""
ALTER EDGE work2 CHANGE (age string);
ALTER EDGE work2 CHANGE (age int64);
"""
Then the execution should be successful
When executing query:
"""
ALTER EDGE work2 CHANGE (age string);
"""
Then a ExecutionError should be raised at runtime:
When executing query:
"""
SHOW CREATE EDGE work2;
"""
Then the result should be, in any order:
| Edge | Create Edge |
| "work2" | 'CREATE EDGE `work2` (\n `email` string NULL,\n `age` string NULL,\n `gender` string NULL\n) ttl_duration = 0, ttl_col = ""' |
| "work2" | 'CREATE EDGE `work2` (\n `email` string NULL,\n `age` int64 NULL,\n `gender` string NULL\n) ttl_duration = 0, ttl_col = ""' |
When executing query:
"""
CREATE EDGE player(id int, name string, age int, address string, score float);
Expand All @@ -340,27 +350,27 @@ Feature: TTLTest
| "player" | 'CREATE EDGE `player` (\n `id` int64 NULL,\n `name` string NULL,\n `age` int64 NULL,\n `address` string NULL,\n `score` float NULL\n) ttl_duration = 0, ttl_col = ""' |
When executing query:
"""
ALTER EDGE player change(name int), drop(name);
ALTER EDGE player change(name string), drop(name);
"""
Then a SemanticError should be raised at runtime: Duplicate column name `name'
When executing query:
"""
ALTER EDGE player drop(name), change(name int);
ALTER EDGE player drop(name), change(name string);
"""
Then a SemanticError should be raised at runtime: Duplicate column name `name'
When executing query:
"""
ALTER EDGE player drop(name, name), change(address int);
ALTER EDGE player drop(name, name), change(address string);
"""
Then a SemanticError should be raised at runtime: Duplicate column name `name'
When executing query:
"""
ALTER EDGE player change(address int, address string);
ALTER EDGE player change(address string, address string);
"""
Then a SemanticError should be raised at runtime: Duplicate column name `address'
When executing query:
"""
ALTER EDGE player change(address int), drop(name);
ALTER EDGE player change(address string), drop(name);
"""
Then the execution should be successful
When executing query:
Expand All @@ -369,7 +379,7 @@ Feature: TTLTest
"""
Then the result should be, in any order:
| Edge | Create Edge |
| "player" | 'CREATE EDGE `player` (\n `id` int64 NULL,\n `age` int64 NULL,\n `address` int64 NULL,\n `score` float NULL\n) ttl_duration = 0, ttl_col = ""' |
| "player" | 'CREATE EDGE `player` (\n `id` int64 NULL,\n `age` int64 NULL,\n `address` string NULL,\n `score` float NULL\n) ttl_duration = 0, ttl_col = ""' |
And drop the used space

Scenario: TTLTest Datatest
Expand Down

0 comments on commit f4fdadd

Please sign in to comment.