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

Fixed and added tests for node reload_secure_settings and usage APIs. #694

Merged
merged 2 commits into from
Nov 26, 2024
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
4 changes: 3 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,10 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
- Added `PhoneAnalyzer` from `analysis-phonenumber` plugin ([#609](https://github.com/opensearch-project/opensearch-api-specification/pull/609))
- Added `/_list/indices` & `/_list/shards` api specs ([#613](https://github.com/opensearch-project/opensearch-api-specification/pull/613))
- Added `GET` and `HEAD /{index}/_source/{id}` returning `404` ([#673](https://github.com/opensearch-project/opensearch-api-specification/pull/673))
- Added `rename_alias_pattern` and `rename_alias_replacment` to `/_snapshot/{repository}/{snapshot}/_restore` body parameters ([#615](https://github.com/opensearch-project/opensearch-api-specification/pull/615))
- Added `rename_alias_pattern` and `rename_alias_replacement` to `/_snapshot/{repository}/{snapshot}/_restore` body parameters ([#615](https://github.com/opensearch-project/opensearch-api-specification/pull/615))
- Added `resource_stats` to `TaskInfoBase` ([#692](https://github.com/opensearch-project/opensearch-api-specification/pull/692))
- Added `s` to `/_ingest/processor/grok` ([#689](https://github.com/opensearch-project/opensearch-api-specification/pull/689))
- Added `aggregations` to `/nodes/_usage/{metric}` requests and responses ([#615](https://github.com/opensearch-project/opensearch-api-specification/pull/615))

### 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 All @@ -41,6 +42,7 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
- Fixed `value` type in `ExplanationDetail` and added `_type` to `explain@200` ([#685](https://github.com/opensearch-project/opensearch-api-specification/pull/685))
- Fixed index settings types ([#684](https://github.com/opensearch-project/opensearch-api-specification/pull/684))
- Fixed `POST` and `DELETE /_dangling/{index_uuid}` returning `202` ([#686](https://github.com/opensearch-project/opensearch-api-specification/pull/686))
- Fixed response schema for `/_nodes/reload_secure_settings` and `/_nodes/{node_id}/reload_secure_settings` ([#694](https://github.com/opensearch-project/opensearch-api-specification/pull/694))
- Fixed `/_ingest/pipeline/{id}/_simulate` response `docs/_source` field schema ([#689](https://github.com/opensearch-project/opensearch-api-specification/pull/689))

### Changed
Expand Down
15 changes: 10 additions & 5 deletions spec/schemas/nodes._common.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -187,8 +187,8 @@ components:
_nodes:
$ref: '_common.yaml#/components/schemas/NodeStatistics'
NodeReloadResult:
oneOf:
- $ref: '#/components/schemas/Stats'
anyOf:
- $ref: '#/components/schemas/NodeReloadResponse'
- $ref: '#/components/schemas/NodeReloadError'
Stats:
type: object
Expand Down Expand Up @@ -1299,15 +1299,20 @@ components:
replica_rejections:
description: Number of indexing requests rejected in the replica stage.
type: number
NodeReloadError:
NodeReloadResponse:
type: object
properties:
name:
$ref: '_common.yaml#/components/schemas/Name'
reload_exception:
$ref: '_common.yaml#/components/schemas/ErrorCause'
required:
- name
NodeReloadError:
allOf:
- $ref: '#/components/schemas/NodeReloadResponse'
- type: object
properties:
reload_exception:
$ref: '_common.yaml#/components/schemas/ErrorCause'
SampleType:
type: string
description: The type to sample.
Expand Down
3 changes: 1 addition & 2 deletions spec/schemas/nodes.usage.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ components:
type: string
enum:
- _all
- aggregations
- rest_actions
ResponseBase:
allOf:
Expand Down Expand Up @@ -41,7 +42,5 @@ components:
additionalProperties:
type: object
required:
- aggregations
- rest_actions
- since
- timestamp
16 changes: 16 additions & 0 deletions tests/default/nodes/reload_secure_settings.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
$schema: ../../../json_schemas/test_story.schema.yaml

description: The nodes reload secure settings endpoint.
chapters:
- synopsis: Reload secure settings for all nodes.
path: /_nodes/reload_secure_settings
method: POST
response:
status: 200
- synopsis: Reload secure settings for a node.
path: /_nodes/{node_id}/reload_secure_settings
method: POST
parameters:
node_id: _all
response:
status: 200
11 changes: 11 additions & 0 deletions tests/default/nodes/stats.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -179,3 +179,14 @@ chapters:
- search
response:
status: 200
- synopsis: Get statistics for search (`node_id`).
path: /_nodes/{node_id}/stats/{metric}/{index_metric}
method: GET
parameters:
node_id: _all
metric:
- indices
index_metric:
- search
response:
status: 200
60 changes: 60 additions & 0 deletions tests/default/nodes/usage.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
$schema: ../../../json_schemas/test_story.schema.yaml

description: Test nodes usage.
chapters:
- synopsis: Get usage for all nodes.
path: /_nodes/usage
method: GET
response:
status: 200
- synopsis: Get usage for all nodes for all metrics.
path: /_nodes/usage/{metric}
method: GET
parameters:
metric:
- _all
response:
status: 200
- synopsis: Get usage for all nodes for the `rest_actions` metric.
path: /_nodes/usage/{metric}
method: GET
parameters:
metric:
- rest_actions
response:
status: 200
- synopsis: Get usage for all nodes for the `aggregations` metric.
path: /_nodes/usage/{metric}
method: GET
parameters:
metric:
- aggregations
response:
status: 200
- synopsis: Get usage for all nodes (`node_id`).
path: /_nodes/{node_id}/usage
method: GET
parameters:
node_id: _all
response:
status: 200
- synopsis: Get usage for all nodes for all metrics (`node_id`).
path: /_nodes/{node_id}/usage/{metric}
method: GET
parameters:
node_id: _all
metric:
- _all
response:
status: 200
- synopsis: Get usage for all nodes and all metrics.
warnings:
multiple-paths-detected: false
path: /_nodes/{node_id}/{metric}
method: GET
parameters:
node_id: _all
metric:
- _all
response:
status: 200