diff --git a/.github/workflows/test-spec.yml b/.github/workflows/test-spec.yml index 4837c221f..8af9cc891 100644 --- a/.github/workflows/test-spec.yml +++ b/.github/workflows/test-spec.yml @@ -20,7 +20,7 @@ jobs: test-opensearch-spec: runs-on: ubuntu-latest env: - OPENSEARCH_VERSION: 2.12.0 + OPENSEARCH_VERSION: 2.15.0 OPENSEARCH_PASSWORD: myStrongPassword123! steps: - name: Checkout Repo diff --git a/CHANGELOG.md b/CHANGELOG.md index 55248104d..12ce686f3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -63,6 +63,7 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) - Fixed optional field in `/_nodes` ([#365](https://github.com/opensearch-project/opensearch-api-specification/pull/365)) - Fixed `/{index}/_open` can return a `task` ([#376](https://github.com/opensearch-project/opensearch-api-specification/pull/376)) - Fixed `_source` in `bulk` responses ([#375](https://github.com/opensearch-project/opensearch-api-specification/pull/375)) +- Fixed `/{index}/_dangling` that can return `nodes` and `cluster_name` ([#391](https://github.com/opensearch-project/opensearch-api-specification/pull/391)) ### Security diff --git a/spec/namespaces/dangling_indices.yaml b/spec/namespaces/dangling_indices.yaml index 9af8528c8..75113107c 100644 --- a/spec/namespaces/dangling_indices.yaml +++ b/spec/namespaces/dangling_indices.yaml @@ -71,6 +71,10 @@ components: schema: type: object properties: + _nodes: + $ref: '../schemas/_common.yaml#/components/schemas/NodeStatistics' + cluster_name: + $ref: '../schemas/_common.yaml#/components/schemas/Name' dangling_indices: type: array items: diff --git a/tests/_core/aliases.yaml b/tests/indices/aliases.yaml similarity index 100% rename from tests/_core/aliases.yaml rename to tests/indices/aliases.yaml diff --git a/tests/indices/clone.yaml b/tests/indices/clone.yaml new file mode 100644 index 000000000..c56f2b142 --- /dev/null +++ b/tests/indices/clone.yaml @@ -0,0 +1,39 @@ +$schema: ../../json_schemas/test_story.schema.yaml + +description: Test cloning an index. +prologues: + - path: /movies + method: PUT +epilogues: + - path: /movies + method: DELETE + status: [200, 404] + - path: /games + method: DELETE + status: [200, 404] +chapters: + - synopsis: Block writes to the source index. + path: /{index}/_settings + method: PUT + parameters: + index: movies + request_body: + payload: + settings: + index.blocks.write: true + - synopsis: Clone an index. + path: /{index}/_clone/{target} + method: POST + parameters: + index: movies + target: games + wait_for_active_shards: 1 + cluster_manager_timeout: 10s + timeout: 10s + wait_for_completion: true + response: + status: 200 + payload: + shards_acknowledged: true + acknowledged: true + index: games diff --git a/tests/indices/dangling.yaml b/tests/indices/dangling.yaml new file mode 100644 index 000000000..5accfcce8 --- /dev/null +++ b/tests/indices/dangling.yaml @@ -0,0 +1,7 @@ +$schema: ../../json_schemas/test_story.schema.yaml + +description: Test dangling indexes. +chapters: + - synopsis: Get dangling indexes. + path: /_dangling + method: GET diff --git a/tests/indices/flush.yaml b/tests/indices/flush.yaml new file mode 100644 index 000000000..a38c4c65b --- /dev/null +++ b/tests/indices/flush.yaml @@ -0,0 +1,49 @@ +$schema: ../../json_schemas/test_story.schema.yaml + +description: Test flushing an index. +prologues: + - path: /movies + method: PUT +epilogues: + - path: /movies + method: DELETE + status: [200, 404] +chapters: + - synopsis: Flush all indexes (GET). + path: /_flush + method: GET + parameters: + allow_no_indices: true + expand_wildcards: none + force: true + ignore_unavailable: true + wait_if_ongoing: true + response: + status: 200 + payload: + _shards: {} + - synopsis: Flush all indexes (POST). + path: /_flush + method: POST + response: + status: 200 + payload: + _shards: {} + - synopsis: Flush an index (GET). + path: /{index}/_flush + method: GET + parameters: + index: movies + response: + status: 200 + payload: + _shards: {} + - synopsis: Flush an index (POST). + path: /{index}/_flush + method: POST + parameters: + index: movies + response: + status: 200 + payload: + _shards: {} diff --git a/tests/indices/forcemerge.yaml b/tests/indices/forcemerge.yaml new file mode 100644 index 000000000..c35313aa6 --- /dev/null +++ b/tests/indices/forcemerge.yaml @@ -0,0 +1,47 @@ + +$schema: ../../json_schemas/test_story.schema.yaml + +description: Test force merging an index. +prologues: + - path: /movies + method: PUT + - path: /games + method: PUT +epilogues: + - path: /movies,games + method: DELETE + status: [200, 404] +chapters: + - synopsis: Force merge all indexes. + path: /_forcemerge + method: POST + parameters: + allow_no_indices: true + expand_wildcards: none + flush: true + max_num_segments: 1 + only_expunge_deletes: true + primary_only: false + ignore_unavailable: true + response: + status: 200 + payload: + _shards: {} + - synopsis: Force merge an index. + path: /{index}/_forcemerge + method: POST + parameters: + index: movies + response: + status: 200 + payload: + _shards: {} + - synopsis: Force merge multiple indexes. + path: /{index}/_forcemerge + method: POST + parameters: + index: movies,games + response: + status: 200 + payload: + _shards: {} diff --git a/tests/indices/index.yaml b/tests/indices/index.yaml index 3ccd60aee..541d76205 100644 --- a/tests/indices/index.yaml +++ b/tests/indices/index.yaml @@ -39,6 +39,12 @@ chapters: method: HEAD parameters: index: books + allow_no_indices: true + expand_wildcards: none + flat_settings: true + include_defaults: true + ignore_unavailable: true + local: true - synopsis: Check if the index `movies` exists. It should not. path: /{index} diff --git a/tests/indices/_refresh.yaml b/tests/indices/refresh.yaml similarity index 100% rename from tests/indices/_refresh.yaml rename to tests/indices/refresh.yaml diff --git a/tests/indices/settings.yaml b/tests/indices/settings.yaml new file mode 100644 index 000000000..e8cd4aa5d --- /dev/null +++ b/tests/indices/settings.yaml @@ -0,0 +1,69 @@ + +$schema: ../../json_schemas/test_story.schema.yaml + +description: Test settings for an index. +prologues: + - path: /movies + method: PUT +epilogues: + - path: /movies + method: DELETE + status: [200, 404] +chapters: + - synopsis: Get global settings. + path: /_settings + method: GET + parameters: + allow_no_indices: true + expand_wildcards: none + flat_settings: true + include_defaults: true + ignore_unavailable: true + local: true + cluster_manager_timeout: 1s + response: + status: 200 + - synopsis: Write a setting to an index. + path: /{index}/_settings + method: PUT + parameters: + index: movies + request_body: + payload: + settings: + index.blocks.write: true + index: + number_of_replicas: 4 + - synopsis: Get settings for an index. + path: /{index}/_settings + method: GET + parameters: + index: movies + allow_no_indices: true + expand_wildcards: none + response: + status: 200 + payload: + movies: + settings: + index: + provided_name: movies + blocks: + write: 'true' + - synopsis: Get a specific setting for an index. + path: /{index}/_settings/{name} + method: GET + parameters: + index: movies + name: index.blocks.write + response: + status: 200 + payload: + movies: + settings: + index: + blocks: + write: 'true' + + + diff --git a/tests/indices/shrink.yaml b/tests/indices/shrink.yaml new file mode 100644 index 000000000..91359baa6 --- /dev/null +++ b/tests/indices/shrink.yaml @@ -0,0 +1,62 @@ +$schema: ../../json_schemas/test_story.schema.yaml + +description: Test shrinking an index. +prologues: + - path: /movies + method: PUT + request_body: + payload: + settings: + index.number_of_shards: 3 +epilogues: + - path: /movies + method: DELETE + status: [200, 404] + - path: /movies1 + method: DELETE + status: [200, 404] + - path: /movies2 + method: DELETE + status: [200, 404] +chapters: + - synopsis: Block writes to the source index. + path: /{index}/_settings + method: PUT + parameters: + index: movies + request_body: + payload: + settings: + index.blocks.write: true + - synopsis: Shrink an index (POST). + path: /{index}/_shrink/{target} + method: POST + parameters: + index: movies + target: movies1 + wait_for_active_shards: 1 + cluster_manager_timeout: 10s + timeout: 10s + wait_for_completion: true + response: + status: 200 + payload: + shards_acknowledged: true + acknowledged: true + index: movies1 + - synopsis: Shrink an index (PUT). + path: /{index}/_shrink/{target} + method: PUT + parameters: + index: movies + target: movies2 + wait_for_active_shards: 1 + cluster_manager_timeout: 10s + timeout: 10s + wait_for_completion: true + response: + status: 200 + payload: + shards_acknowledged: true + acknowledged: true + index: movies2 \ No newline at end of file diff --git a/tests/indices/split.yaml b/tests/indices/split.yaml new file mode 100644 index 000000000..a4399a984 --- /dev/null +++ b/tests/indices/split.yaml @@ -0,0 +1,72 @@ +$schema: ../../json_schemas/test_story.schema.yaml + +description: Test splitting an index. +prologues: + - path: /movies + method: PUT + request_body: + payload: + settings: + index.number_of_shards: 3 +epilogues: + - path: /movies + method: DELETE + status: [200, 404] + - path: /movies1 + method: DELETE + status: [200, 404] + - path: /movies2 + method: DELETE + status: [200, 404] +chapters: + - synopsis: Block writes to the source index. + path: /{index}/_settings + method: PUT + parameters: + index: movies + request_body: + payload: + settings: + index.blocks.write: true + - synopsis: Split an index (POST). + path: /{index}/_split/{target} + method: POST + parameters: + index: movies + target: movies1 + wait_for_active_shards: 1 + cluster_manager_timeout: 10s + timeout: 10s + wait_for_completion: true + request_body: + payload: + settings: + index: + number_of_shards: 6 + response: + status: 200 + payload: + shards_acknowledged: true + acknowledged: true + index: movies1 + - synopsis: Split an index (PUT). + path: /{index}/_split/{target} + method: PUT + parameters: + index: movies + target: movies2 + wait_for_active_shards: 1 + cluster_manager_timeout: 10s + timeout: 10s + wait_for_completion: true + request_body: + payload: + settings: + index: + number_of_shards: 6 + response: + status: 200 + payload: + shards_acknowledged: true + acknowledged: true + index: movies2 \ No newline at end of file