Skip to content

Commit

Permalink
add ci
Browse files Browse the repository at this point in the history
Committed-by: xiaolei.zl from Dev container
  • Loading branch information
zhanglei1949 committed Sep 20, 2024
1 parent 2127de2 commit d44bd64
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 4 deletions.
14 changes: 14 additions & 0 deletions flex/engines/graph_db/app/builtin/count_vertices.cc
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
/** Copyright 2020 Alibaba Group Holding Limited.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "flex/engines/graph_db/app/builtin/count_vertices.h"

namespace gs {
Expand Down
17 changes: 15 additions & 2 deletions flex/interactive/sdk/python/gs_interactive/tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -395,8 +395,8 @@ def run_cypher_test_suite(neo4j_sess : Neo4jSession, graph_id: str, queries: lis
for query in queries:
submit_query_via_neo4j_endpoint(neo4j_sess, graph_id, query)

def call_procedure(neo4j_sess : Neo4jSession, graph_id: str, proc_name: str):
query = "CALL " + proc_name + "()"
def call_procedure(neo4j_sess : Neo4jSession, graph_id: str, proc_name: str, *args):
query = "CALL " + proc_name + "(" + ",".join(args) + ")"
result = neo4j_sess.run(query)
for record in result:
print(record)
Expand Down Expand Up @@ -435,6 +435,19 @@ def create_procedure(sess: Session, graph_id: str, name: str, query: str, descri
proc_id = resp.get_value().procedure_id
return proc_id

def delete_procedure(sess: Session, graph_id: str, proc_id: str):
resp = sess.delete_procedure(graph_id, proc_id)
if not resp.is_ok():
print("Failed to delete procedure: ", resp.get_status_message())
raise Exception("Failed to delete procedure, status: ", resp.get_status_message())

def update_procedure(sess: Session, graph_id: str, proc_id: str, desc : str):
request = UpdateProcedureRequest(
description=desc)
resp = sess.update_procedure(graph_id, proc_id, request)
if not resp.is_ok():
print("Failed to update procedure: ", resp.get_status_message())
raise Exception("Failed to update procedure, status: ", resp.get_status_message())

def start_service_on_graph(interactive_session, graph_id : str):
resp = interactive_session.start_service(StartServiceRequest(graph_id=graph_id))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@


from gs_interactive.tests.conftest import create_vertex_only_modern_graph, start_service_on_graph,interactive_driver
from gs_interactive.tests.conftest import create_procedure, delete_running_graph, create_modern_graph, create_partial_modern_graph,run_cypher_test_suite, call_procedure
from gs_interactive.tests.conftest import create_procedure,delete_procedure,update_procedure, delete_running_graph, create_modern_graph, create_partial_modern_graph,run_cypher_test_suite, call_procedure
from gs_interactive.tests.conftest import import_data_to_vertex_only_modern_graph, import_data_to_partial_modern_graph, import_data_to_full_modern_graph


Expand Down Expand Up @@ -121,3 +121,18 @@ def test_procedure_creation(interactive_session, neo4j_session, create_modern_gr
with pytest.raises(Exception):
create_procedure(interactive_session, create_modern_graph, "test_proc2", "MATCH(n: IDONTKOWN) return count(n)")

def test_builtin_procedure(interactive_session,neo4j_session, create_modern_graph):
print("[Test builtin procedure]")
# Delete the builtin procedure should fail
with pytest.raises(Exception):
delete_procedure(interactive_session, create_modern_graph, "count_vertices")
# Create a procedure with the same name as builtin procedure should fail
with pytest.raises(Exception):
create_procedure(interactive_session, create_modern_graph, "count_vertices", "MATCH(n: software) return count(n);")
# Update the builtin procedure should fail
with pytest.raises(Exception):
update_procedure(interactive_session, create_modern_graph, "count_vertices", "A updated description")
# Call the builtin procedure
start_service_on_graph(interactive_session, create_modern_graph)
call_procedure(neo4j_session, create_modern_graph, "count_vertices", '"person"')

2 changes: 1 addition & 1 deletion python/setup_gsctl.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def parse_version(root, **kwargs):
if platform.system() == "Linux" and platform.machine() == "aarch64"
else "click >= 8.1.6"
),
"graphscope-flex >= 0.28.1",
"graphscope-flex >= 0.28.0",
"treelib",
"packaging",
"pyyaml",
Expand Down

0 comments on commit d44bd64

Please sign in to comment.