From e79841c6e55fcc8e1a305e6bf623c3df84a5e350 Mon Sep 17 00:00:00 2001 From: dblock Date: Tue, 9 Jul 2024 11:08:42 -0400 Subject: [PATCH 01/12] Added tests for HEAD with parameters. These are documented in https://opensearch.org/docs/latest/api-reference/index-apis/exists/. Signed-off-by: dblock --- tests/indices/index.yaml | 6 ++++++ 1 file changed, 6 insertions(+) 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} From 25e55049d9da4caffaaefa5b5663f5d80c5219f0 Mon Sep 17 00:00:00 2001 From: dblock Date: Tue, 9 Jul 2024 11:10:09 -0400 Subject: [PATCH 02/12] Renamed file for consitency with others. Signed-off-by: dblock --- tests/indices/{_refresh.yaml => refresh.yaml} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename tests/indices/{_refresh.yaml => refresh.yaml} (100%) 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 From 027d87114163dc3e77482cd4d8710ed7d3e1f8a2 Mon Sep 17 00:00:00 2001 From: dblock Date: Tue, 9 Jul 2024 11:23:37 -0400 Subject: [PATCH 03/12] Added tests for /{index}/_clone. Signed-off-by: dblock --- tests/indices/clone.yaml | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 tests/indices/clone.yaml diff --git a/tests/indices/clone.yaml b/tests/indices/clone.yaml new file mode 100644 index 000000000..721f75846 --- /dev/null +++ b/tests/indices/clone.yaml @@ -0,0 +1,36 @@ +$schema: ../../json_schemas/test_story.schema.yaml + +description: Test cloning an index. +prologues: + - path: /movies + method: PUT +epilogues: + - path: /movies,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 From 8930a3d6f7aaaa5b7238461fbcc6f979fdd0e0b7 Mon Sep 17 00:00:00 2001 From: dblock Date: Tue, 9 Jul 2024 11:33:55 -0400 Subject: [PATCH 04/12] Add missing response fields for /_dangling. Signed-off-by: dblock --- spec/namespaces/dangling_indices.yaml | 4 ++++ tests/_core/dangling.yaml | 7 +++++++ 2 files changed, 11 insertions(+) create mode 100644 tests/_core/dangling.yaml 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/dangling.yaml b/tests/_core/dangling.yaml new file mode 100644 index 000000000..5accfcce8 --- /dev/null +++ b/tests/_core/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 From e02c70aba5596e7b275290477f04efa898b72d2f Mon Sep 17 00:00:00 2001 From: dblock Date: Tue, 9 Jul 2024 11:34:54 -0400 Subject: [PATCH 05/12] Moved files into indices for consistency. Signed-off-by: dblock --- tests/{_core => indices}/aliases.yaml | 0 tests/{_core => indices}/dangling.yaml | 0 2 files changed, 0 insertions(+), 0 deletions(-) rename tests/{_core => indices}/aliases.yaml (100%) rename tests/{_core => indices}/dangling.yaml (100%) 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/_core/dangling.yaml b/tests/indices/dangling.yaml similarity index 100% rename from tests/_core/dangling.yaml rename to tests/indices/dangling.yaml From bfb54faed5eb7b4c7444ad4e998e57bbba4a2ac8 Mon Sep 17 00:00:00 2001 From: dblock Date: Tue, 9 Jul 2024 11:38:55 -0400 Subject: [PATCH 06/12] Added tests for /_flush. Signed-off-by: dblock --- tests/indices/flush.yaml | 49 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 tests/indices/flush.yaml 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: {} From 765dc5ec96d2d1778a466a42496acdbbb6c10e78 Mon Sep 17 00:00:00 2001 From: dblock Date: Tue, 9 Jul 2024 11:42:53 -0400 Subject: [PATCH 07/12] Added tests for /{index}/_forcemerge. Signed-off-by: dblock --- tests/indices/forcemerge.yaml | 47 +++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 tests/indices/forcemerge.yaml 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: {} From 2d9fd6e5fe42bb460b51d40f14be5eb1ea0e654f Mon Sep 17 00:00:00 2001 From: dblock Date: Tue, 9 Jul 2024 12:43:41 -0400 Subject: [PATCH 08/12] Added tests for /{index}/_settings. Signed-off-by: dblock --- tests/indices/settings.yaml | 69 +++++++++++++++++++++++++++++++++++++ 1 file changed, 69 insertions(+) create mode 100644 tests/indices/settings.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' + + + From 6cd71b9489412832a62fb89227b6b47003bd93b4 Mon Sep 17 00:00:00 2001 From: dblock Date: Tue, 9 Jul 2024 12:50:43 -0400 Subject: [PATCH 09/12] Added tests for /{index}/_shrink. Signed-off-by: dblock --- tests/indices/clone.yaml | 5 +++- tests/indices/shrink.yaml | 59 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 63 insertions(+), 1 deletion(-) create mode 100644 tests/indices/shrink.yaml diff --git a/tests/indices/clone.yaml b/tests/indices/clone.yaml index 721f75846..c56f2b142 100644 --- a/tests/indices/clone.yaml +++ b/tests/indices/clone.yaml @@ -5,7 +5,10 @@ prologues: - path: /movies method: PUT epilogues: - - path: /movies,games + - path: /movies + method: DELETE + status: [200, 404] + - path: /games method: DELETE status: [200, 404] chapters: diff --git a/tests/indices/shrink.yaml b/tests/indices/shrink.yaml new file mode 100644 index 000000000..5af70c8c3 --- /dev/null +++ b/tests/indices/shrink.yaml @@ -0,0 +1,59 @@ +$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: /games1,games2 + 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: games1 + 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: games1 + - synopsis: Shrink an index (PUT). + path: /{index}/_shrink/{target} + method: PUT + parameters: + index: movies + target: games2 + 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: games2 \ No newline at end of file From d745858a0a460f93232f4ffcebba92ce4cea36ce Mon Sep 17 00:00:00 2001 From: dblock Date: Tue, 9 Jul 2024 12:54:18 -0400 Subject: [PATCH 10/12] Added tests for /{index}/_split. Signed-off-by: dblock --- tests/indices/shrink.yaml | 13 ++++--- tests/indices/split.yaml | 72 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 80 insertions(+), 5 deletions(-) create mode 100644 tests/indices/split.yaml diff --git a/tests/indices/shrink.yaml b/tests/indices/shrink.yaml index 5af70c8c3..91359baa6 100644 --- a/tests/indices/shrink.yaml +++ b/tests/indices/shrink.yaml @@ -12,7 +12,10 @@ epilogues: - path: /movies method: DELETE status: [200, 404] - - path: /games1,games2 + - path: /movies1 + method: DELETE + status: [200, 404] + - path: /movies2 method: DELETE status: [200, 404] chapters: @@ -30,7 +33,7 @@ chapters: method: POST parameters: index: movies - target: games1 + target: movies1 wait_for_active_shards: 1 cluster_manager_timeout: 10s timeout: 10s @@ -40,13 +43,13 @@ chapters: payload: shards_acknowledged: true acknowledged: true - index: games1 + index: movies1 - synopsis: Shrink an index (PUT). path: /{index}/_shrink/{target} method: PUT parameters: index: movies - target: games2 + target: movies2 wait_for_active_shards: 1 cluster_manager_timeout: 10s timeout: 10s @@ -56,4 +59,4 @@ chapters: payload: shards_acknowledged: true acknowledged: true - index: games2 \ No newline at end of file + 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 From 18eb6160af0739b3139d5c4dc5c098aa1aa6166c Mon Sep 17 00:00:00 2001 From: dblock Date: Tue, 9 Jul 2024 12:58:59 -0400 Subject: [PATCH 11/12] Updated CHANGELOG. Signed-off-by: dblock --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) 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 From 71256f3af45dfeed533109ae4ae3a6582b31698f Mon Sep 17 00:00:00 2001 From: dblock Date: Tue, 9 Jul 2024 13:15:56 -0400 Subject: [PATCH 12/12] Use OpenSearch 2.15. Signed-off-by: dblock --- .github/workflows/test-spec.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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