diff --git a/.github/workflows/pull_request.yml b/.github/workflows/pull_request.yml index fb614a7b022..974509d8d35 100644 --- a/.github/workflows/pull_request.yml +++ b/.github/workflows/pull_request.yml @@ -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 diff --git a/tests/Makefile b/tests/Makefile index 0f372b6db18..60f0508bf94 100644 --- a/tests/Makefile +++ b/tests/Makefile @@ -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 @@ -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 \ diff --git a/tests/common/utils.py b/tests/common/utils.py index 6f2f62ed0db..75323d0b83b 100644 --- a/tests/common/utils.py +++ b/tests/common/utils.py @@ -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 diff --git a/tests/conftest.py b/tests/conftest.py index 7802f31238d..4f79d1de866 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -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") diff --git a/tests/data/ldbc/config.yaml b/tests/data/ldbc_v0_3_3/config.yaml similarity index 100% rename from tests/data/ldbc/config.yaml rename to tests/data/ldbc_v0_3_3/config.yaml diff --git a/tests/tck/conftest.py b/tests/tck/conftest.py index bfe85af7734..f75060c47d0 100644 --- a/tests/tck/conftest.py +++ b/tests/tck/conftest.py @@ -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, ): @@ -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) diff --git a/tests/tck/ldbc/business_intelligence_workload/Read.feature b/tests/tck/ldbc/business_intelligence_workload/Read.feature index 40993778a04..c913038b89d 100644 --- a/tests/tck/ldbc/business_intelligence_workload/Read.feature +++ b/tests/tck/ldbc/business_intelligence_workload/Read.feature @@ -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: @@ -131,9 +131,9 @@ 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, @@ -141,7 +141,7 @@ Feature: LDBC Business Intelligence Workload - Read 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: @@ -162,9 +162,9 @@ 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, @@ -172,7 +172,7 @@ Feature: LDBC Business Intelligence Workload - Read 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: @@ -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, @@ -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: @@ -342,9 +340,9 @@ 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, @@ -352,7 +350,7 @@ Feature: LDBC Business Intelligence Workload - Read 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: @@ -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 @@ -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: @@ -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..] diff --git a/tests/tck/ldbc/interactive_workload/ComplexReads.feature b/tests/tck/ldbc/interactive_workload/ComplexReads.feature index 8a57b843e3b..52acc82bda7 100644 --- a/tests/tck/ldbc/interactive_workload/ComplexReads.feature +++ b/tests/tck/ldbc/interactive_workload/ComplexReads.feature @@ -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 diff --git a/tests/tck/ldbc/interactive_workload/ShortReads.feature b/tests/tck/ldbc/interactive_workload/ShortReads.feature index 1e45c2d808b..f7c40564202 100644 --- a/tests/tck/ldbc/interactive_workload/ShortReads.feature +++ b/tests/tck/ldbc/interactive_workload/ShortReads.feature @@ -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: diff --git a/tests/tck/steps/test_ldbc.py b/tests/tck/steps/test_ldbc.py new file mode 100644 index 00000000000..3a3a3c0e407 --- /dev/null +++ b/tests/tck/steps/test_ldbc.py @@ -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')