diff --git a/tests/e2e/text_search/CMakeLists.txt b/tests/e2e/text_search/CMakeLists.txt new file mode 100644 index 000000000..db2af7a11 --- /dev/null +++ b/tests/e2e/text_search/CMakeLists.txt @@ -0,0 +1,6 @@ +function(copy_text_search_e2e_python_files FILE_NAME) + copy_e2e_python_files(text_search ${FILE_NAME}) +endfunction() + +copy_text_search_e2e_python_files(common.py) +copy_text_search_e2e_python_files(test_text_search.py) diff --git a/tests/e2e/text_search/common.py b/tests/e2e/text_search/common.py new file mode 100644 index 000000000..870c80d83 --- /dev/null +++ b/tests/e2e/text_search/common.py @@ -0,0 +1,45 @@ +# Copyright 2023 Memgraph Ltd. +# +# Use of this software is governed by the Business Source License +# included in the file licenses/BSL.txt; by using this file, you agree to be bound by the terms of the Business Source +# License, and you may not use this file except in compliance with the Business Source License. +# +# As of the Change Date specified in that file, in accordance with +# the Business Source License, use of this software will be governed +# by the Apache License, Version 2.0, included in the file +# licenses/APL.txt. + +import typing + +import mgclient +import pytest +from gqlalchemy import Memgraph + + +def execute_and_fetch_all(cursor: mgclient.Cursor, query: str, params: dict = {}) -> typing.List[tuple]: + cursor.execute(query, params) + return cursor.fetchall() + + +@pytest.fixture +def connect(**kwargs) -> mgclient.Connection: + connection = mgclient.connect(host="localhost", port=7687, **kwargs) + connection.autocommit = True + cursor = connection.cursor() + execute_and_fetch_all(cursor, "USE DATABASE memgraph") + try: + execute_and_fetch_all(cursor, "DROP DATABASE clean") + except: + pass + execute_and_fetch_all(cursor, "MATCH (n) DETACH DELETE n") + yield connection + + +@pytest.fixture +def memgraph(**kwargs) -> Memgraph: + memgraph = Memgraph() + + yield memgraph + + memgraph.drop_database() + memgraph.drop_indexes() diff --git a/tests/e2e/text_search/test_text_search.py b/tests/e2e/text_search/test_text_search.py new file mode 100644 index 000000000..a4550dd33 --- /dev/null +++ b/tests/e2e/text_search/test_text_search.py @@ -0,0 +1,62 @@ +# Copyright 2024 Memgraph Ltd. +# +# Use of this software is governed by the Business Source License +# included in the file licenses/BSL.txt; by using this file, you agree to be bound by the terms of the Business Source +# License, and you may not use this file except in compliance with the Business Source License. +# +# As of the Change Date specified in that file, in accordance with +# the Business Source License, use of this software will be governed +# by the Apache License, Version 2.0, included in the file +# licenses/APL.txt. + +import sys + +import pytest +from common import memgraph + + +def test_create_index(memgraph): + memgraph.execute("CREATE TEXT INDEX complianceDocuments ON :Document;") + + assert True + + +def test_drop_index(memgraph): + memgraph.execute("DROP TEXT INDEX complianceDocuments;") + assert True + + +def test_text_search_given_property(): + assert True + + +def test_text_search_all_properties(): + assert True + + +def test_create_indexed_node(): + assert True + + +def test_delete_indexed_node(): + assert True + + +def test_add_indexed_label(): + assert True + + +def test_remove_indexed_label(): + assert True + + +def test_add_property_to_indexed_node(): + assert True + + +def test_remove_property_from_indexed_node(): + assert True + + +if __name__ == "__main__": + sys.exit(pytest.main([__file__, "-rA"])) diff --git a/tests/e2e/text_search/workloads.yaml b/tests/e2e/text_search/workloads.yaml new file mode 100644 index 000000000..4460c37b8 --- /dev/null +++ b/tests/e2e/text_search/workloads.yaml @@ -0,0 +1,14 @@ +text_search_cluster: &text_search_cluster + cluster: + main: + args: ["--bolt-port", "7687", "--log-level=TRACE"] + log_file: "text_search.log" + setup_queries: [] + validation_queries: [] + +workloads: + - name: "Test text search behavior in Memgraphm" + binary: "tests/e2e/pytest_runner.sh" + proc: "tests/e2e/text_search/query_modules/" + args: ["text_search/test_text_search.py"] + <<: *text_search_cluster