Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support add listener in tck #5006

Merged
merged 9 commits into from
Dec 19, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .github/workflows/nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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/[email protected]
with:
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/pull_request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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/[email protected]
with:
Expand Down
10 changes: 9 additions & 1 deletion tests/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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)
Expand Down
15 changes: 12 additions & 3 deletions tests/common/nebula_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
15 changes: 15 additions & 0 deletions tests/tck/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
49 changes: 49 additions & 0 deletions tests/tck/features/fulltext_index/FulltextIndex.feature
Original file line number Diff line number Diff line change
@@ -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" |