Skip to content

Commit

Permalink
adding missing tests (opensearch-project#749)
Browse files Browse the repository at this point in the history
* adding missing tests

Signed-off-by: Tokesh <[email protected]>

* fixing validate ci, links, added node failure in specs

Signed-off-by: Tokesh <[email protected]>

* adding node failures to changelog, fixing path in specs of update by query and small fix in response of query group tests

Signed-off-by: Tokesh <[email protected]>

* Support combining multiple output variables. (opensearch-project#737)

* Support combining multiple output variables.

Signed-off-by: dblock <[email protected]>
Signed-off-by: Tokesh <[email protected]>

* hotfix of method in snapshots

Signed-off-by: Tokesh <[email protected]>

* hotfix with snapshot tests

Signed-off-by: Tokesh <[email protected]>

* hotfix race condition

Signed-off-by: Tokesh <[email protected]>

* adding chapter in snapshot tests

Signed-off-by: Tokesh <[email protected]>

* correcting path to repository in snapshot tests

Signed-off-by: Tokesh <[email protected]>

* adding verbose to check ci

Signed-off-by: Tokesh <[email protected]>

* deleting verbose

Signed-off-by: Tokesh <[email protected]>

* added retry to status in snapshots

Signed-off-by: Tokesh <[email protected]>

* added retry to correct place

Signed-off-by: Tokesh <[email protected]>

* adding verbose to check

Signed-off-by: Tokesh <[email protected]>

* renaming to avoid race condition

Signed-off-by: Tokesh <[email protected]>

* refactoring folder organization, adding retries, fixing naming

Signed-off-by: Tokesh <[email protected]>

---------

Signed-off-by: Tokesh <[email protected]>
Signed-off-by: dblock <[email protected]>
Signed-off-by: Niyazbek Torekeldi <[email protected]>
Co-authored-by: Daniel (dB.) Doubrovkine <[email protected]>
  • Loading branch information
Tokesh and dblock authored Dec 19, 2024
1 parent 4231dad commit a2afe56
Show file tree
Hide file tree
Showing 7 changed files with 103 additions and 5 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
- Added missing `cancelled` and `resource_stats` to `/_reindex/{task_id}/_rethrottle` ([#740](https://github.com/opensearch-project/opensearch-api-specification/pull/740))
- Added missing `cancellation_time_millis` to `POST /_tasks/_cancel` ([#747](https://github.com/opensearch-project/opensearch-api-specification/pull/747))
- Added support for combining output variables ([#737](https://github.com/opensearch-project/opensearch-api-specification/pull/737))
- Added 404 response to `/_search/scroll` ([#749](https://github.com/opensearch-project/opensearch-api-specification/pull/749))
- Added `node_failures` to `DELETE /_search/scroll` and `DELETE /_search/scroll/{scroll_id}` ([#749](https://github.com/opensearch-project/opensearch-api-specification/pull/749))

### Removed
- Removed unsupported `_common.mapping:SourceField`'s `mode` field and associated `_common.mapping:SourceFieldMode` enum ([#652](https://github.com/opensearch-project/opensearch-api-specification/pull/652))
Expand Down
22 changes: 22 additions & 0 deletions spec/namespaces/_core.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -956,6 +958,8 @@ paths:
responses:
'200':
$ref: '#/components/responses/clear_scroll@200'
'404':
$ref: '#/components/responses/clear_scroll@404'
/_search/template:
get:
operationId: search_template.0
Expand Down Expand Up @@ -2868,6 +2872,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:
Expand Down Expand Up @@ -3370,6 +3388,10 @@ components:
type: object
additionalProperties:
$ref: '../schemas/_core.update_by_query_rethrottle.yaml#/components/schemas/UpdateByQueryRethrottleNode'
node_failures:
type: array
items:
$ref: '../schemas/_common.yaml#/components/schemas/ErrorCause'
required:
- nodes
parameters:
Expand Down
8 changes: 8 additions & 0 deletions tests/default/_core/search/scroll.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
25 changes: 25 additions & 0 deletions tests/default/_core/update_by_query/rethrottle.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
$schema: ../../../../json_schemas/test_story.schema.yaml

description: Test Update By Query rethrottle endpoint.
prologues:
- path: /books/_update_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

22 changes: 20 additions & 2 deletions tests/plugins/workload-management/wlm/query_group.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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: soft
- synopsis: Get the QueryGroup by name.
path: /_wlm/query_group/{name}
method: GET
Expand All @@ -24,11 +34,19 @@ chapters:
query_groups:
- name: analytics
resource_limits:
memory: 0.1
resiliency_mode: monitor
memory: 0.2
resiliency_mode: soft
- 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: soft
- synopsis: Delete a QueryGroup.
path: /_wlm/query_group/{name}
parameters:
Expand Down
27 changes: 24 additions & 3 deletions tests/snapshot/snapshot/snapshot.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,12 @@ epilogues:
parameters:
repository: my-fs-repository
snapshot: my-test-snapshot
- path: /_snapshot/{repository}/{snapshot}
method: DELETE
status: [200, 404]
parameters:
repository: my-fs-repository
snapshot: my-second-snapshot
- path: /_snapshot/{repository}
method: DELETE
status: [200, 404]
Expand Down Expand Up @@ -65,7 +71,22 @@ chapters:
status: 200
payload:
snapshot:
snapshot: my-test-snapshot
snapshot: my-test-snapshot
- synopsis: Create a second snapshot.
path: /_snapshot/{repository}/{snapshot}
method: POST
parameters:
repository: my-fs-repository
snapshot: my-second-snapshot
wait_for_completion: true
request:
payload:
indices: '*'
response:
status: 200
payload:
snapshot:
snapshot: my-second-snapshot
- synopsis: Get information about a snapshot.
path: /_snapshot/{repository}/{snapshot}
method: GET
Expand All @@ -82,13 +103,13 @@ chapters:
method: GET
parameters:
repository: my-fs-repository
snapshot: my-test-snapshot
snapshot: my-second-snapshot
human: true
response:
status: 200
payload:
snapshots:
- snapshot: my-test-snapshot
- snapshot: my-second-snapshot
- synopsis: Delete a snapshot.
path: /_snapshot/{repository}/{snapshot}
method: DELETE
Expand Down
2 changes: 2 additions & 0 deletions tests/snapshot/snapshot/status.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ prologues:
ignore_unavailable: true
include_global_state: false
partial: true
retry:
count: 3
chapters:
- synopsis: Get status of all running snapshots.
path: /_snapshot/_status
Expand Down

0 comments on commit a2afe56

Please sign in to comment.