From 740079cae261758682b9c241a1bd24d4128567cb Mon Sep 17 00:00:00 2001 From: Pascal Seitz Date: Wed, 21 Feb 2024 13:37:06 +0800 Subject: [PATCH] add test for delete on es API --- .../src/elasticsearch_api/filter.rs | 2 +- .../es_compatibility/0024-delete_indices.yaml | 30 +++++++++++++++++++ .../es_compatibility/_teardown.quickwit.yaml | 15 ++++++++++ 3 files changed, 46 insertions(+), 1 deletion(-) create mode 100644 quickwit/rest-api-tests/scenarii/es_compatibility/0024-delete_indices.yaml diff --git a/quickwit/quickwit-serve/src/elasticsearch_api/filter.rs b/quickwit/quickwit-serve/src/elasticsearch_api/filter.rs index ca3f524d2fe..71c62d82587 100644 --- a/quickwit/quickwit-serve/src/elasticsearch_api/filter.rs +++ b/quickwit/quickwit-serve/src/elasticsearch_api/filter.rs @@ -177,7 +177,7 @@ pub(crate) fn elastic_delete_index_filter( ) -> impl Filter,), Error = Rejection> + Clone { warp::path!("_elastic" / String) .and_then(extract_index_id_patterns) - .and(warp::get()) + .and(warp::delete()) } // No support for any query parameters for now. diff --git a/quickwit/rest-api-tests/scenarii/es_compatibility/0024-delete_indices.yaml b/quickwit/rest-api-tests/scenarii/es_compatibility/0024-delete_indices.yaml new file mode 100644 index 00000000000..02f51acc0c8 --- /dev/null +++ b/quickwit/rest-api-tests/scenarii/es_compatibility/0024-delete_indices.yaml @@ -0,0 +1,30 @@ +--- +method: POST +api_root: http://localhost:7280/api/v1/ +endpoint: indexes/ +json: + version: "0.7" + index_id: test_index1 + doc_mapping: + mode: dynamic +sleep_after: 3 +--- +method: POST +api_root: http://localhost:7280/api/v1/ +endpoint: indexes/ +json: + version: "0.7" + index_id: test_index2 + doc_mapping: + mode: dynamic +sleep_after: 3 +--- +method: DELETE +api_root: http://localhost:7280/api/v1/ +endpoint: _elastic/test_index1,does_not_exist +status_code: 404 +--- +method: DELETE +api_root: http://localhost:7280/api/v1/ +endpoint: _elastic/test_index1,test_index2 +status_code: 200 diff --git a/quickwit/rest-api-tests/scenarii/es_compatibility/_teardown.quickwit.yaml b/quickwit/rest-api-tests/scenarii/es_compatibility/_teardown.quickwit.yaml index 4b1a0e2a202..746e2160601 100644 --- a/quickwit/rest-api-tests/scenarii/es_compatibility/_teardown.quickwit.yaml +++ b/quickwit/rest-api-tests/scenarii/es_compatibility/_teardown.quickwit.yaml @@ -7,3 +7,18 @@ endpoint: indexes/gharchive method: DELETE api_root: http://localhost:7280/api/v1/ endpoint: indexes/empty_index +--- +method: DELETE +api_root: http://localhost:7280/api/v1/ +endpoint: indexes/test_index1 +status_code: null +--- # Cleanup +method: DELETE +api_root: http://localhost:7280/api/v1/ +endpoint: indexes/test_index2 +status_code: null +--- # Cleanup +method: DELETE +api_root: http://localhost:7280/api/v1/ +endpoint: indexes/test_index1 +status_code: null