From 7b32b67b96cad36c3e8f4569cfb2ababbb643042 Mon Sep 17 00:00:00 2001 From: Tokesh Date: Wed, 18 Dec 2024 22:56:02 +0500 Subject: [PATCH] adding missing tests Signed-off-by: Tokesh --- CHANGELOG.md | 1 + spec/namespaces/_core.yaml | 16 ++++++++++++ tests/default/_core/search/scroll.yaml | 8 ++++++ tests/default/_core/update_by_query.yaml | 25 +++++++++++++++++++ .../workload-management/wlm/query_group.yaml | 22 ++++++++++++++-- tests/snapshot/snapshot/restore.yaml | 4 ++- 6 files changed, 73 insertions(+), 3 deletions(-) create mode 100644 tests/default/_core/update_by_query.yaml diff --git a/CHANGELOG.md b/CHANGELOG.md index 60c0eb3df..6143190f7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -191,6 +191,7 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) - Added API spec for `adjust_pure_negative` for bool queries ([#641](https://github.com/opensearch-project/opensearch-api-specification/pull/641)) - Added a spec style checker [#620](https://github.com/opensearch-project/opensearch-api-specification/pull/620). - Added `remote_store` to node `Stats` ([#643](https://github.com/opensearch-project/opensearch-api-specification/pull/643)) +- Added 404 response to `/_search/scroll` ([#x](https://github.com/opensearch-project/opensearch-api-specification/pull/x)) ### Changed diff --git a/spec/namespaces/_core.yaml b/spec/namespaces/_core.yaml index 63a36d3d9..846ad5932 100644 --- a/spec/namespaces/_core.yaml +++ b/spec/namespaces/_core.yaml @@ -898,6 +898,8 @@ paths: responses: '200': $ref: '#/components/responses/clear_scroll@200' + '404': + $ref: '#/components/responses/clear_scroll@404' /_search/scroll/{scroll_id}: get: operationId: scroll.2 @@ -2868,6 +2870,20 @@ components: required: - num_freed - succeeded + clear_scroll@404: + content: + application/json: + schema: + type: object + properties: + succeeded: + type: boolean + num_freed: + type: integer + format: int32 + required: + - num_freed + - succeeded count@200: content: application/json: diff --git a/tests/default/_core/search/scroll.yaml b/tests/default/_core/search/scroll.yaml index fb4baccd1..6ed9e10ff 100644 --- a/tests/default/_core/search/scroll.yaml +++ b/tests/default/_core/search/scroll.yaml @@ -105,3 +105,11 @@ chapters: path: /_search/scroll/{scroll_id} parameters: scroll_id: ${scroll.scroll_id} + - synopsis: Deleting a non-existent scroll. + method: DELETE + path: /_search/scroll + request: + payload: + scroll_id: ${scroll.scroll_id} + response: + status: 404 diff --git a/tests/default/_core/update_by_query.yaml b/tests/default/_core/update_by_query.yaml new file mode 100644 index 000000000..40a1ad72e --- /dev/null +++ b/tests/default/_core/update_by_query.yaml @@ -0,0 +1,25 @@ +$schema: ../../../json_schemas/test_story.schema.yaml + +description: Test Update By Query endpoint. +prologues: + - path: /books/_delete_by_query + id: task + method: POST + parameters: + refresh: true + conflicts: proceed + wait_for_completion: false + request: + payload: + query: + match_all: {} + output: + id: payload.task +chapters: + - synopsis: Update by query. + path: /_update_by_query/{task_id}/_rethrottle + method: POST + parameters: + task_id: ${task.id} + requests_per_second: 10 + diff --git a/tests/plugins/workload-management/wlm/query_group.yaml b/tests/plugins/workload-management/wlm/query_group.yaml index aa6a68b9d..da286e8df 100644 --- a/tests/plugins/workload-management/wlm/query_group.yaml +++ b/tests/plugins/workload-management/wlm/query_group.yaml @@ -13,6 +13,16 @@ chapters: resource_limits: memory: 0.1 resiliency_mode: monitor + - synopsis: Update a QueryGroup by name. + path: /_wlm/query_group/{name} + method: PUT + parameters: + name: analytics + request: + payload: + resource_limits: + memory: 0.2 + resiliency_mode: restrict - synopsis: Get the QueryGroup by name. path: /_wlm/query_group/{name} method: GET @@ -24,11 +34,19 @@ chapters: query_groups: - name: analytics resource_limits: - memory: 0.1 - resiliency_mode: monitor + memory: 0.2 + resiliency_mode: restrict - synopsis: Get all QueryGroups. path: /_wlm/query_group method: GET + response: + status: 200 + payload: + query_groups: + - name: analytics + resource_limits: + memory: 0.2 + resiliency_mode: restrict - synopsis: Delete a QueryGroup. path: /_wlm/query_group/{name} parameters: diff --git a/tests/snapshot/snapshot/restore.yaml b/tests/snapshot/snapshot/restore.yaml index d2eaad807..29c1d799b 100644 --- a/tests/snapshot/snapshot/restore.yaml +++ b/tests/snapshot/snapshot/restore.yaml @@ -50,7 +50,9 @@ prologues: index: stories alias: stories_alias - path: /_snapshot/{repository}/{snapshot} - method: PUT + method: + - POST + - PUT parameters: repository: my-fs-repository snapshot: my-test-snapshot