Skip to content

Commit

Permalink
Fix pytest.
Browse files Browse the repository at this point in the history
  • Loading branch information
CPWstatic committed Jan 4, 2022
1 parent bac1091 commit 8200f48
Show file tree
Hide file tree
Showing 10 changed files with 58 additions and 35 deletions.
5 changes: 5 additions & 0 deletions .github/workflows/pull_request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,11 @@ jobs:
make RM_DIR=false DEBUG=false J=${{ steps.cmake.outputs.j }} tck
working-directory: tests/
timeout-minutes: 60
- name: LDBC
run: |
make RM_DIR=false DEBUG=false J=${{ steps.cmake.outputs.j }} ldbc
working-directory: tests/
timeout-minutes: 60
- name: Down cluster
run: |
make RM_DIR=false down
Expand Down
7 changes: 5 additions & 2 deletions tests/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#
# This source code is licensed under Apache 2.0 License.

.PHONY: fmt check check-and-diff init init-all clean test tck fail up down test-all
.PHONY: fmt check check-and-diff init init-all clean test tck fail up down test-all ldbc

PYPI_MIRROR = https://mirrors.aliyun.com/pypi/simple/
# PYPI_MIRROR = http://pypi.mirrors.ustc.edu.cn/simple --trusted-host pypi.mirrors.ustc.edu.cn
Expand Down Expand Up @@ -93,7 +93,10 @@ slow-query: currdir
tck: jobs slow-query
$(test_j) tck/steps/test_tck.py

test-all: test tck
ldbc: currdir
$(test_j) tck/steps/test_ldbc.py

test-all: test tck ldbc

fail: currdir
python3 -m pytest \
Expand Down
5 changes: 3 additions & 2 deletions tests/common/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -432,8 +432,9 @@ def load_csv_data(
# wait heartbeat_interval_secs + 1 seconds for schema synchronization
time.sleep(2)

for fd in config["files"]:
_load_data_from_file(sess, data_dir, fd)
if config["files"] is not None:
for fd in config["files"]:
_load_data_from_file(sess, data_dir, fd)

return space_desc

Expand Down
5 changes: 5 additions & 0 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,11 @@ def load_nba_int_vid_data():
yield load_csv_data_once("nba_int_vid")


@pytest.fixture(scope="session")
def load_ldbc_v0_3_3():
yield load_csv_data_once("ldbc_v0_3_3")


@pytest.fixture(scope="session")
def load_student_data():
yield load_csv_data_once("student")
Expand Down
File renamed without changes.
3 changes: 3 additions & 0 deletions tests/tck/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,7 @@ def preload_space(
load_nba_data,
load_nba_int_vid_data,
load_student_data,
load_ldbc_v0_3_3,
session,
graph_spaces,
):
Expand All @@ -184,6 +185,8 @@ def preload_space(
graph_spaces["space_desc"] = load_nba_int_vid_data
elif space == "student":
graph_spaces["space_desc"] = load_student_data
elif space == "ldbc_v0_3_3":
graph_spaces["ldbc_v0_3_3"] = load_ldbc_v0_3_3
else:
raise ValueError(f"Invalid space name given: {space}")
resp_ok(session, f'USE {space};', True)
Expand Down
57 changes: 28 additions & 29 deletions tests/tck/ldbc/business_intelligence_workload/Read.feature
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
Feature: LDBC Business Intelligence Workload - Read

Background:
Given a graph with space named "ldbc-v0.3.3"
Given a graph with space named "ldbc_v0_3_3"

Scenario: 1. Posting summary
When executing query:
Expand Down Expand Up @@ -131,17 +131,17 @@ Feature: LDBC Business Intelligence Workload - Read
WHERE id(country) == "Burma"
RETURN
forum.Forum.id AS forumId,
forum.Forum.title,
forum.Forum.creationDate,
person.Person.id,
forum.Forum.title AS forumTitle,
forum.Forum.creationDate AS forumCreationDate,
person.Person.id AS personId,
count(DISTINCT post) AS postCount
ORDER BY
postCount DESC,
forumId ASC
LIMIT 20
"""
Then the result should be, in order:
| forumId | forum.title | forum.creationDate | person.id | postCount |
| forumId | forumTitle | forumCreationDate | personId | postCount |

Scenario: 5. Top posters in a country
When executing query:
Expand All @@ -162,17 +162,17 @@ Feature: LDBC Business Intelligence Workload - Read
WHERE popularForum IN popularForums
RETURN
person.Person.id AS personId,
person.Person.firstName,
person.Person.lastName,
person.Person.creationDate,
person.Person.firstName AS personFirstName,
person.Person.lastName AS personLastName,
person.Person.creationDate AS personCreationDate,
count(DISTINCT post) AS postCount
ORDER BY
postCount DESC,
personId ASC
LIMIT 100
"""
Then the result should be, in order:
| personId | person.firstName | person.lastName | person.creationDate | postCount |
| personId | personFirstName | personLastName | personCreationDate | postCount |

Scenario: 6. Most active posters of a given topic
When executing query:
Expand All @@ -183,7 +183,7 @@ Feature: LDBC Business Intelligence Workload - Read
OPTIONAL MATCH (message)<-[:REPLY_OF]-(comment:`Comment`)
WITH person, count(DISTINCT like) AS likeCount, count(DISTINCT comment) AS replyCount, count(DISTINCT message) AS messageCount
RETURN
person.id AS personId,
person.Person.id AS personId,
replyCount,
likeCount,
messageCount,
Expand All @@ -199,20 +199,18 @@ Feature: LDBC Business Intelligence Workload - Read
Scenario: 7. Most authoritative users on a given topic
When executing query:
"""
MATCH (`tag`:`Tag`)<-[:HAS_TAG]-(message:Message)-[:HAS_CREATOR]->(person:Person)
WHERE id(`tag`) == "Abbas_I_of_Persia"
OPTIONAL MATCH (:Person)-[like:LIKES]->(message)
OPTIONAL MATCH (message)<-[:REPLY_OF]-(comment:`Comment`)
WITH person, count(DISTINCT like) AS likeCount, count(DISTINCT comment) AS replyCount, count(DISTINCT message) AS messageCount
MATCH (`tag`:`Tag`)
WHERE id(`tag`) == "Arnold_Schwarzenegger"
MATCH (`tag`)<-[:HAS_TAG]-(message1:Message)-[:HAS_CREATOR]->(person1:Person)
MATCH (`tag`)<-[:HAS_TAG]-(message2:Message)-[:HAS_CREATOR]->(person1)
OPTIONAL MATCH (message2)<-[:LIKES]-(person2:Person)
OPTIONAL MATCH (person2)<-[:HAS_CREATOR]-(message3:Message)<-[like:LIKES]-(p3:Person)
RETURN
person.Person.id AS personId,
replyCount,
likeCount,
messageCount,
1*messageCount + 2*replyCount + 10*likeCount AS score
person1.Person.id AS person1Id,
count(DISTINCT like) AS authorityScore
ORDER BY
score DESC,
personId ASC
authorityScore DESC,
person1Id ASC
LIMIT 100
"""
Then the result should be, in order:
Expand Down Expand Up @@ -342,17 +340,17 @@ Feature: LDBC Business Intelligence Workload - Read
WHERE likeCount > 400
RETURN
message.Message.id AS messageId,
message.Message.creationDate,
creator.Person.firstName,
creator.Person.lastName,
message.Message.creationDate AS messageCreationDate,
creator.Person.firstName AS creatorFirstName,
creator.Person.lastName AS creatorLastName,
likeCount
ORDER BY
likeCount DESC,
messageId ASC
LIMIT 100
"""
Then the result should be, in order:
| messageId | message.creationDate | creator.firstName | creator.lastName | likeCount |
| messageId | messageCreationDate | creatorFirstName | creatorLastName | likeCount |

Scenario: 13. Popular tags per month in a country
When executing query:
Expand Down Expand Up @@ -399,8 +397,8 @@ Feature: LDBC Business Intelligence Workload - Read
AND post.Post.creationDate <= "20120630220000000"
RETURN
person.Person.id AS personId,
person.Person.firstName,
person.Person.lastName,
person.Person.firstName AS personFirstName,
person.Person.lastName AS personLastName,
count(DISTINCT post) AS threadCount,
count(DISTINCT reply) AS messageCount
ORDER BY
Expand All @@ -409,7 +407,7 @@ Feature: LDBC Business Intelligence Workload - Read
LIMIT 100
"""
Then the result should be, in any order:
| personId | person.firstName | person.lastName | threadCount | messageCount |
| personId | personFirstName | personLastName | threadCount | messageCount |

Scenario: 15. Social normals
When executing query:
Expand Down Expand Up @@ -482,6 +480,7 @@ Feature: LDBC Business Intelligence Workload - Read
"""
Then the result should be, in any order:
| count |
| 0 |

Scenario: 18. How many persons have a given number of messages
# TODO: [:REPLY_OF*0..]
Expand Down
2 changes: 1 addition & 1 deletion tests/tck/ldbc/interactive_workload/ComplexReads.feature
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
Feature: LDBC Interactive Workload - Complex Reads

Background:
Given a graph with space named "ldbc-v0.3.3"
Given a graph with space named "ldbc_v0_3_3"

@skip
Scenario: 1. Friends with certain name
Expand Down
2 changes: 1 addition & 1 deletion tests/tck/ldbc/interactive_workload/ShortReads.feature
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
Feature: LDBC Interactive Workload - Short Reads

Background:
Given a graph with space named "ldbc-v0.3.3"
Given a graph with space named "ldbc_v0_3_3"

Scenario: 1. Friends with certain name
When executing query:
Expand Down
7 changes: 7 additions & 0 deletions tests/tck/steps/test_ldbc.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Copyright (c) 2021 vesoft inc. All rights reserved.
#
# This source code is licensed under Apache 2.0 License.

from pytest_bdd import scenarios

scenarios('ldbc')

0 comments on commit 8200f48

Please sign in to comment.