Add test cases
This commit is contained in:
parent
0c3220839c
commit
99417f75b6
6
tests/e2e/text_search/CMakeLists.txt
Normal file
6
tests/e2e/text_search/CMakeLists.txt
Normal file
@ -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)
|
45
tests/e2e/text_search/common.py
Normal file
45
tests/e2e/text_search/common.py
Normal file
@ -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()
|
62
tests/e2e/text_search/test_text_search.py
Normal file
62
tests/e2e/text_search/test_text_search.py
Normal file
@ -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"]))
|
14
tests/e2e/text_search/workloads.yaml
Normal file
14
tests/e2e/text_search/workloads.yaml
Normal file
@ -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
|
Loading…
Reference in New Issue
Block a user