From 2d3268e76ba664c4bf65888d9cf38e147021958b Mon Sep 17 00:00:00 2001 From: Zhang Lei Date: Thu, 29 Aug 2024 16:37:42 +0800 Subject: [PATCH] fix(interactive): Fix robust test (#4193) Fix the bug in robust test. Related issue: https://github.com/alibaba/GraphScope/issues/4192 --- .../sdk/python/gs_interactive/client/session.py | 4 ++-- .../sdk/python/gs_interactive/tests/conftest.py | 1 - .../python/gs_interactive/tests/test_robustness.py | 12 ++++++++---- 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/flex/interactive/sdk/python/gs_interactive/client/session.py b/flex/interactive/sdk/python/gs_interactive/client/session.py index d72da741061b..36a1a85eb0a0 100644 --- a/flex/interactive/sdk/python/gs_interactive/client/session.py +++ b/flex/interactive/sdk/python/gs_interactive/client/session.py @@ -616,7 +616,7 @@ def call_procedure_raw(self, graph_id: StrictStr, params: bytes) -> Result[str]: # Here we add byte of value 1 to denote the input format is in encoder/decoder format response = self._query_api.call_proc_with_http_info( graph_id = graph_id, - body = append_format_byte(params.encode(), InputFormat.CPP_ENCODER) + body = append_format_byte(params, InputFormat.CPP_ENCODER) ) return Result.from_response(response) except Exception as e: @@ -627,7 +627,7 @@ def call_procedure_current_raw(self, params: bytes) -> Result[str]: # gs_interactive currently support four type of inputformat, see flex/engines/graph_db/graph_db_session.h # Here we add byte of value 1 to denote the input format is in encoder/decoder format response = self._query_api.call_proc_current_with_http_info( - body = append_format_byte(params.encode(), InputFormat.CPP_ENCODER) + body = append_format_byte(params, InputFormat.CPP_ENCODER) ) return Result.from_response(response) except Exception as e: diff --git a/flex/interactive/sdk/python/gs_interactive/tests/conftest.py b/flex/interactive/sdk/python/gs_interactive/tests/conftest.py index b589b8b92b1f..7770279083f8 100644 --- a/flex/interactive/sdk/python/gs_interactive/tests/conftest.py +++ b/flex/interactive/sdk/python/gs_interactive/tests/conftest.py @@ -382,7 +382,6 @@ def import_data_to_full_modern_graph(sess: Session, graph_id: str): assert wait_job_finish(sess, job_id) def submit_query_via_neo4j_endpoint(neo4j_sess : Neo4jSession, graph_id: str, query: str): - query = "MATCH(n) return n" result = neo4j_sess.run(query) #check have 1 records, result 0 result_cnt = 0 diff --git a/flex/interactive/sdk/python/gs_interactive/tests/test_robustness.py b/flex/interactive/sdk/python/gs_interactive/tests/test_robustness.py index f3ba08fa7349..11f3d40e528d 100644 --- a/flex/interactive/sdk/python/gs_interactive/tests/test_robustness.py +++ b/flex/interactive/sdk/python/gs_interactive/tests/test_robustness.py @@ -32,11 +32,15 @@ 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 -cypher_queries = [ +vertex_only_cypher_queries = [ "MATCH(n) return count(n)", "MATCH(n) return n", "MATCH(n) return n limit 10", - "MATCH()-[r]->() return count(r)", +] + +# extend the query list to include queries that are not supported by vertex-only graph +cypher_queries = vertex_only_cypher_queries + [ + #"MATCH()-[e]->() return count(e)", # currently not supported by compiler+ffi, see https://github.com/alibaba/GraphScope/issues/4192 "MATCH(a)-[b]->(c) return count(b)", "MATCH(a)-[b]->(c) return b", "MATCH(a)-[b]->(c) return c.id", @@ -48,11 +52,11 @@ def test_query_on_vertex_only_graph(interactive_session, neo4j_session, create_v """ print("[Query on vertex only graph]") start_service_on_graph(interactive_session, create_vertex_only_modern_graph) - run_cypher_test_suite(neo4j_session, create_vertex_only_modern_graph, cypher_queries) + run_cypher_test_suite(neo4j_session, create_vertex_only_modern_graph, vertex_only_cypher_queries) start_service_on_graph(interactive_session,"1") import_data_to_vertex_only_modern_graph(interactive_session, create_vertex_only_modern_graph) - run_cypher_test_suite(neo4j_session, create_vertex_only_modern_graph, cypher_queries) + run_cypher_test_suite(neo4j_session, create_vertex_only_modern_graph, vertex_only_cypher_queries) def test_query_on_partial_graph(interactive_session,neo4j_session, create_partial_modern_graph): """