From 14ecacbf3e39314d36b700ea0c35a01496e5ce4d Mon Sep 17 00:00:00 2001 From: trinity-1686a Date: Fri, 8 Nov 2024 12:00:30 +0100 Subject: [PATCH] add integration test --- .../bulk/_teardown.quickwit.yaml | 4 ++ .../qw_search_api/0004_empty_string.yaml | 49 +++++++++++++++++++ .../qw_search_api/_setup.quickwit.yaml | 29 +++++++++++ .../qw_search_api/_teardown.quickwit.yaml | 3 ++ 4 files changed, 85 insertions(+) create mode 100644 quickwit/rest-api-tests/scenarii/qw_search_api/0004_empty_string.yaml diff --git a/quickwit/rest-api-tests/scenarii/es_compatibility/bulk/_teardown.quickwit.yaml b/quickwit/rest-api-tests/scenarii/es_compatibility/bulk/_teardown.quickwit.yaml index 4accabf684c..07f10e2acb4 100644 --- a/quickwit/rest-api-tests/scenarii/es_compatibility/bulk/_teardown.quickwit.yaml +++ b/quickwit/rest-api-tests/scenarii/es_compatibility/bulk/_teardown.quickwit.yaml @@ -4,4 +4,8 @@ endpoint: indexes/test-index --- method: DELETE api_root: http://localhost:7280/api/v1/ +endpoint: indexes/test-index-pattern-777 +--- +method: DELETE +api_root: http://localhost:7280/api/v1/ endpoint: templates/test-index-template diff --git a/quickwit/rest-api-tests/scenarii/qw_search_api/0004_empty_string.yaml b/quickwit/rest-api-tests/scenarii/qw_search_api/0004_empty_string.yaml new file mode 100644 index 00000000000..9a71716896a --- /dev/null +++ b/quickwit/rest-api-tests/scenarii/qw_search_api/0004_empty_string.yaml @@ -0,0 +1,49 @@ +# This tests a simple request with no queries. +endpoint: empty-string/search +params: + query: "str:''" +expected: + num_hits: 2 +--- +endpoint: empty-string/search +params: + query: "str_array:''" +expected: + num_hits: 2 +--- +endpoint: empty-string/search +params: + query: "dyn_str:''" +expected: + num_hits: 2 +--- +endpoint: empty-string/search +params: + query: "dyn_str_array:''" +expected: + num_hits: 2 +--- +endpoint: empty-string/search +params: + query: "str:'' AND str_array:ghi" +expected: + num_hits: 1 +--- +endpoint: empty-string/search +params: + query: "str_array:'' AND str_array:ghi" +expected: + num_hits: 1 +--- +endpoint: empty-string/search +params: + query: "dyn_str:'' AND str_array:ghi" +expected: + num_hits: 1 +--- +endpoint: empty-string/search +params: + query: "dyn_str_array:'' AND str_array:ghi" +expected: + num_hits: 1 +--- diff --git a/quickwit/rest-api-tests/scenarii/qw_search_api/_setup.quickwit.yaml b/quickwit/rest-api-tests/scenarii/qw_search_api/_setup.quickwit.yaml index 84270d975b4..64ee2eef7b8 100644 --- a/quickwit/rest-api-tests/scenarii/qw_search_api/_setup.quickwit.yaml +++ b/quickwit/rest-api-tests/scenarii/qw_search_api/_setup.quickwit.yaml @@ -82,3 +82,32 @@ params: commit: force ndjson: - {"seq": 4, "tag": 1} +--- +method: DELETE +endpoint: indexes/empty-string +status_code: null +--- +# Create index +method: POST +endpoint: indexes/ +json: + version: "0.7" + index_id: empty-string + doc_mapping: + mode: dynamic + field_mappings: + - name: str + type: text + - name: str_array + type: array +--- +# Ingest documents +method: POST +endpoint: empty-string/ingest +params: + commit: force +ndjson: + - {"str": "abc", "str_array": ["abc", "def"], "dyn_str": "abc", "dyn_str_array": ["abc", "def"]} + - {"str": "", "str_array": [""], "dyn_str": "", "dyn_str_array": [""]} + - {"str": "", "str_array": ["ghi", ""], "dyn_str": "", "dyn_str_array": ["ghi", ""]} + - {"str_array": [], "dyn_str_array": []} diff --git a/quickwit/rest-api-tests/scenarii/qw_search_api/_teardown.quickwit.yaml b/quickwit/rest-api-tests/scenarii/qw_search_api/_teardown.quickwit.yaml index a2896f541b1..9f3013b25be 100644 --- a/quickwit/rest-api-tests/scenarii/qw_search_api/_teardown.quickwit.yaml +++ b/quickwit/rest-api-tests/scenarii/qw_search_api/_teardown.quickwit.yaml @@ -4,3 +4,6 @@ endpoint: indexes/simple --- method: DELETE endpoint: indexes/tagged +--- +method: DELETE +endpoint: indexes/empty-string