Add e2e tests for disabled text search

This commit is contained in:
Ante Pušić 2024-02-18 19:47:13 +01:00
parent 260221faaa
commit c14e14dde5
2 changed files with 63 additions and 2 deletions

View File

@ -0,0 +1,42 @@
# 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 gqlalchemy
import pytest
from common import memgraph
TEXT_SEARCH_DISABLED_ERROR = (
"To use text indices and text search, start Memgraph with the experimental text search feature enabled."
)
def test_create_index(memgraph):
with pytest.raises(gqlalchemy.exceptions.GQLAlchemyDatabaseError, match=TEXT_SEARCH_DISABLED_ERROR) as _:
memgraph.execute("""CREATE TEXT INDEX exampleIndex ON :Document;""")
def test_drop_index(memgraph):
with pytest.raises(gqlalchemy.exceptions.GQLAlchemyDatabaseError, match=TEXT_SEARCH_DISABLED_ERROR) as _:
memgraph.execute("""DROP TEXT INDEX exampleIndex;""")
def test_text_search_given_property(memgraph):
with pytest.raises(gqlalchemy.exceptions.GQLAlchemyDatabaseError, match=TEXT_SEARCH_DISABLED_ERROR) as _:
memgraph.execute(
"""CALL text_search.search("complianceDocuments", "data.title:Rules2024") YIELD node
RETURN node;"""
)
if __name__ == "__main__":
sys.exit(pytest.main([__file__, "-rA"]))

View File

@ -1,14 +1,33 @@
text_search_cluster: &text_search_cluster
cluster:
main:
args: ["--bolt-port", "7687", "--log-level=TRACE", "--experimental-enabled=text-search"]
args:
[
"--bolt-port",
"7687",
"--log-level=TRACE",
"--experimental-enabled=text-search",
]
log_file: "text_search.log"
setup_queries: []
validation_queries: []
text_search_disabled_cluster: &text_search_disabled_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 Memgraph"
- name: "Test behavior of text search in Memgraph"
binary: "tests/e2e/pytest_runner.sh"
proc: "tests/e2e/text_search/query_modules/"
args: ["text_search/test_text_search.py"]
<<: *text_search_cluster
- name: "Test behavior of text search in Memgraph when disabled"
binary: "tests/e2e/pytest_runner.sh"
proc: "tests/e2e/text_search/query_modules/"
args: ["text_search/test_text_search_disabled.py"]
<<: *text_search_disabled_cluster