diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index 4c02c578a8f..3fa9b884fa0 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -225,13 +225,14 @@ jobs: image: elasticsearch:7.17.7 ports: - 9200:9200 + - 9300:9300 env: discovery.type: single-node options: >- --health-cmd "curl elasticsearch:9200" --health-interval 10s --health-timeout 5s - --health-retries 5 + --health-retries 10 steps: - uses: webiny/action-post-run@2.0.1 with: diff --git a/.github/workflows/pull_request.yml b/.github/workflows/pull_request.yml index dec44ef31cb..2f1c077c6fb 100644 --- a/.github/workflows/pull_request.yml +++ b/.github/workflows/pull_request.yml @@ -77,13 +77,14 @@ jobs: image: elasticsearch:7.17.7 ports: - 9200:9200 + - 9300:9300 env: discovery.type: single-node options: >- --health-cmd "curl elasticsearch:9200" --health-interval 10s --health-timeout 5s - --health-retries 5 + --health-retries 10 steps: - uses: webiny/action-post-run@2.0.1 with: diff --git a/tests/Makefile b/tests/Makefile index 46d703e9310..cdd1f2e957e 100644 --- a/tests/Makefile +++ b/tests/Makefile @@ -14,6 +14,7 @@ TEST_DIR ?= $(CURR_DIR) BUILD_DIR ?= $(CURR_DIR)/../build DEBUG ?= true J ?= 10 +ENABLE_ES ?= false ENABLE_SSL ?= false ENABLE_GRAPH_SSL ?= false ENABLE_META_SSL ?= false @@ -27,7 +28,14 @@ QUERY_CONCURRENTLY ?= false # commands gherkin_fmt = ~/.local/bin/reformat-gherkin run_test = PYTHONPATH=$$PYTHONPATH:$(CURR_DIR)/.. $(CURR_DIR)/nebula-test-run.py -test_without_skip = python3 -m pytest -m "not skip" --build_dir=$(BUILD_DIR) + +ifeq ($(ENABLE_ES),false) + PYTEST_MARKEXPR="not skip and not ft_index" +else + PYTEST_MARKEXPR="not skip" +endif + +test_without_skip = python3 -m pytest -m $(PYTEST_MARKEXPR) --build_dir=$(BUILD_DIR) test_without_skip_sa = python3 -m pytest -m "not skip and not distonly" --build_dir=$(BUILD_DIR) test_j = $(test_without_skip) -n$(J) test_j_sa = $(test_without_skip_sa) -n$(J) diff --git a/tests/common/nebula_service.py b/tests/common/nebula_service.py index 8b9f1681c51..5e4995eab03 100644 --- a/tests/common/nebula_service.py +++ b/tests/common/nebula_service.py @@ -186,21 +186,30 @@ def __init__( self.init_standalone() def init_standalone(self): - process_count = self.metad_num + self.storaged_num + self.graphd_num + process_count = self.metad_num + self.storaged_num + self.graphd_num + self.listener_num ports_count = process_count * self.ports_per_process self.all_ports = self._find_free_port(ports_count) print(self.all_ports) + sa_ports_count= self.metad_num + self.storaged_num + self.graphd_num index = 0 standalone = NebulaProcess( "standalone", - self.all_ports[index: index + ports_count], + self.all_ports[index: index + sa_ports_count], index, self.graphd_param, is_standalone=True ) + index = index + 1 + listener = NebulaProcess( + "listener", + self.all_ports[index: index + self.ports_per_process], + 0, + self.listener_param + ) self.graphd_processes.append(standalone) + self.listener_processes.append(listener) self.all_processes = ( - self.graphd_processes + self.graphd_processes + self.listener_processes ) # update meta address meta_server_addrs = ','.join( diff --git a/tests/tck/conftest.py b/tests/tck/conftest.py index ec763b2ecf8..2b35433e921 100644 --- a/tests/tck/conftest.py +++ b/tests/tck/conftest.py @@ -236,6 +236,21 @@ def new_space(request, options, exec_ctx): exec_ctx["drop_space"] = True +@given(parse("add listeners to space")) +def add_listeners(request, exec_ctx): + show_listener = "show hosts storage listener" + exec_query(request, show_listener, exec_ctx) + result = exec_ctx["result_set"][0] + assert result.is_succeeded() + values = result.row_values(0) + host = values[0] + port = values[1] + add_listener = f"ADD LISTENER ELASTICSEARCH {host}:{port}" + exec_ctx['result_set'] = [] + exec_query(request, add_listener, exec_ctx) + result = exec_ctx["result_set"][0] + assert result.is_succeeded() + @given(parse("Any graph")) def new_space(request, exec_ctx): name = "EmptyGraph_" + space_generator() diff --git a/tests/tck/features/fulltext_index/FulltextIndex.feature b/tests/tck/features/fulltext_index/FulltextIndex.feature new file mode 100644 index 00000000000..65efbf0f14f --- /dev/null +++ b/tests/tck/features/fulltext_index/FulltextIndex.feature @@ -0,0 +1,49 @@ +# Copyright (c) 2022 vesoft inc. All rights reserved. +# +# This source code is licensed under Apache 2.0 License. +Feature: FulltextIndexTest_Vid_String + + Background: + Given an empty graph + And create a space with following options: + | partition_num | 1 | + | replica_factor | 1 | + | vid_type | FIXED_STRING(30) | + And add listeners to space + And having executed: + """ + SIGN IN TEXT SERVICE(elasticsearch:9200, HTTP) + """ + + @ft_index + Scenario: fulltext demo + When executing query: + """ + CREATE TAG ft_tag(prop1 string) + """ + Then the execution should be successful + When executing query: + """ + CREATE TAG INDEX index_ft_tag_prop1 on ft_tag(prop1) + """ + Then the execution should be successful + When executing query: + """ + CREATE FULLTEXT TAG INDEX nebula_index_1 on ft_tag(prop1) + """ + Then the execution should be successful + And wait 6 seconds + When executing query: + """ + INSERT INTO ft_tag(prop1) VALUES "1":("abc"); + """ + Then the execution should be successful + And wait 5 seconds + When executed query: + """ + LOOKUP ON ft_tag where prefix(ft_tag.prop1,"abc") + YIELD id(vertex) as id, ft_tag.prop1 as prop1 + """ + Then the result should be, in any order: + | id | prop1 | + | "1" | "abc" |