From c1acefd468c117f19f401c29e4c577878a29055a Mon Sep 17 00:00:00 2001 From: dblock Date: Thu, 11 Jul 2024 16:04:45 -0400 Subject: [PATCH] The primary_only and wait_for_completion parameters were introduced in 2.13 and 2.7 respectively. Signed-off-by: dblock --- SPECIFICATION_TESTING.md | 2 +- json_schemas/test_story.schema.yaml | 2 +- spec/namespaces/indices.yaml | 7 +++++++ tests/_core/search.yaml | 2 +- tests/cat/fielddata.yaml | 2 +- tests/cat/pit_segments.yaml | 2 +- tests/cat/segment_replication.yaml | 2 +- tests/indices/cache.yaml | 2 +- tests/indices/clone.yaml | 11 ++++++++++- tests/indices/forcemerge.yaml | 17 ++++++++++++++++- tests/indices/open.yaml | 9 +-------- tests/indices/shrink.yaml | 12 ++++++++++-- tests/indices/split.yaml | 17 +++++++++++++++-- 13 files changed, 66 insertions(+), 21 deletions(-) diff --git a/SPECIFICATION_TESTING.md b/SPECIFICATION_TESTING.md index 1c63d2276..fd583bc11 100644 --- a/SPECIFICATION_TESTING.md +++ b/SPECIFICATION_TESTING.md @@ -142,7 +142,7 @@ It's common to add a feature to the next version of OpenSearch. When adding a ne ```yaml - synopsis: Search with `phase_took` added in OpenSearch 2.12. - version: '>= 2.12.0' + version: '>= 2.12' path: /{index}/_search parameters: index: movies diff --git a/json_schemas/test_story.schema.yaml b/json_schemas/test_story.schema.yaml index e2663a159..e81360b8b 100644 --- a/json_schemas/test_story.schema.yaml +++ b/json_schemas/test_story.schema.yaml @@ -96,7 +96,7 @@ definitions: Version: description: | - The semver range to execute the chapter against. + The semver range to execute the story or chapter against. type: string RequestBody: diff --git a/spec/namespaces/indices.yaml b/spec/namespaces/indices.yaml index 7cbf8c999..cc1d4928d 100644 --- a/spec/namespaces/indices.yaml +++ b/spec/namespaces/indices.yaml @@ -2866,6 +2866,7 @@ components: $ref: '../schemas/_common.yaml#/components/schemas/WaitForActiveShards' style: form indices.clone::query.wait_for_completion: + x-version-added: '2.7' name: wait_for_completion in: query description: Should this request wait until the operation has completed before returning. @@ -3516,6 +3517,7 @@ components: type: boolean style: form indices.forcemerge::query.primary_only: + x-version-added: '2.13' name: primary_only in: query description: Specify whether the operation should only perform on primary shards. Defaults to false. @@ -3524,6 +3526,7 @@ components: default: false description: Specify whether the operation should only perform on primary shards. Defaults to false. indices.forcemerge::query.wait_for_completion: + x-version-added: '2.7' in: query name: wait_for_completion description: Should the request wait until the force merge is completed. @@ -4099,6 +4102,7 @@ components: $ref: '../schemas/_common.yaml#/components/schemas/WaitForActiveShards' style: form indices.open::query.wait_for_completion: + x-version-added: '2.7' name: wait_for_completion in: query description: Should this request wait until the operation has completed before returning. @@ -4709,6 +4713,7 @@ components: $ref: '../schemas/_common.yaml#/components/schemas/WaitForActiveShards' style: form indices.shrink::query.wait_for_completion: + x-version-added: '2.7' name: wait_for_completion in: query description: Should this request wait until the operation has completed before returning. @@ -4875,6 +4880,7 @@ components: $ref: '../schemas/_common.yaml#/components/schemas/WaitForActiveShards' style: form indices.split::query.wait_for_completion: + x-version-added: '2.7' name: wait_for_completion in: query description: Should this request wait until the operation has completed before returning. @@ -5037,6 +5043,7 @@ components: type: boolean description: If true, only ancient (an older Lucene major release) segments will be upgraded. indices.upgrade::query.wait_for_completion: + x-version-added: '2.7' name: wait_for_completion in: query description: Should this request wait until the operation has completed before returning. diff --git a/tests/_core/search.yaml b/tests/_core/search.yaml index 9a5190fe7..fcfb4da33 100644 --- a/tests/_core/search.yaml +++ b/tests/_core/search.yaml @@ -96,7 +96,7 @@ chapters: response: status: 200 - synopsis: Search with phase_took. - version: '>= 2.12.0' + version: '>= 2.12' path: /{index}/_search parameters: index: movies diff --git a/tests/cat/fielddata.yaml b/tests/cat/fielddata.yaml index 10bbf5feb..35a6721a1 100644 --- a/tests/cat/fielddata.yaml +++ b/tests/cat/fielddata.yaml @@ -10,7 +10,7 @@ chapters: response: status: 200 - synopsis: Cat with a json response (from security-analytics). - version: '>= 2.4.0' + version: '>= 2.4' path: /_cat/fielddata method: GET parameters: diff --git a/tests/cat/pit_segments.yaml b/tests/cat/pit_segments.yaml index ab8dd5f87..6b110aa9a 100644 --- a/tests/cat/pit_segments.yaml +++ b/tests/cat/pit_segments.yaml @@ -1,7 +1,7 @@ $schema: ../../json_schemas/test_story.schema.yaml description: Test cat/pit_segments endpoints. -version: '>= 2.4.0' +version: '>= 2.4' epilogues: - path: /games method: DELETE diff --git a/tests/cat/segment_replication.yaml b/tests/cat/segment_replication.yaml index be6dd084a..cdc2af500 100644 --- a/tests/cat/segment_replication.yaml +++ b/tests/cat/segment_replication.yaml @@ -1,7 +1,7 @@ $schema: ../../json_schemas/test_story.schema.yaml description: Test cat/segment_replication endpoints. -version: '>= 2.7.0' +version: '>= 2.7' chapters: - synopsis: Cat with a json response. path: /_cat/segment_replication diff --git a/tests/indices/cache.yaml b/tests/indices/cache.yaml index b44b03a56..4a592fcc5 100644 --- a/tests/indices/cache.yaml +++ b/tests/indices/cache.yaml @@ -32,7 +32,7 @@ chapters: payload: _shards: {} - synopsis: Clear all cache, file=true (POST). - version: '>= 2.8.0' + version: '>= 2.8' path: /_cache/clear method: POST parameters: diff --git a/tests/indices/clone.yaml b/tests/indices/clone.yaml index c56f2b142..5a3b5d998 100644 --- a/tests/indices/clone.yaml +++ b/tests/indices/clone.yaml @@ -30,10 +30,19 @@ chapters: 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 + - synopsis: Clone an index (wait_for_completion). + version: '>= 2.7' + path: /{index}/_clone/{target} + method: POST + parameters: + index: movies + target: games + wait_for_completion: true + response: + status: 200 diff --git a/tests/indices/forcemerge.yaml b/tests/indices/forcemerge.yaml index c35313aa6..0e884d1e5 100644 --- a/tests/indices/forcemerge.yaml +++ b/tests/indices/forcemerge.yaml @@ -21,12 +21,27 @@ chapters: flush: true max_num_segments: 1 only_expunge_deletes: true - primary_only: false ignore_unavailable: true response: status: 200 payload: _shards: {} + - synopsis: Force merge all indexes (primary_only). + version: '>= 2.13' + path: /_forcemerge + method: POST + parameters: + primary_only: true + response: + status: 200 + - synopsis: Force merge all indexes (wait_for_completion). + version: '>= 2.7' + path: /_forcemerge + method: POST + parameters: + wait_for_completion: true + response: + status: 200 - synopsis: Force merge an index. path: /{index}/_forcemerge method: POST diff --git a/tests/indices/open.yaml b/tests/indices/open.yaml index dbcade065..e69d9802a 100644 --- a/tests/indices/open.yaml +++ b/tests/indices/open.yaml @@ -30,25 +30,18 @@ chapters: wait_for_active_shards: 0 cluster_manager_timeout: 30s timeout: 30s - wait_for_completion: true response: status: 200 payload: shards_acknowledged: true acknowledged: true - synopsis: Open a closed index (wait_for_completion=false). + version: '>= 2.7' path: /{index}/_open method: POST parameters: index: movies - allow_no_indices: true - expand_wildcards: all - ignore_unavailable: true - wait_for_active_shards: 0 - cluster_manager_timeout: 30s - timeout: 30s wait_for_completion: false - task_execution_timeout: 1m response: status: 200 - synopsis: Open an already opened index. diff --git a/tests/indices/shrink.yaml b/tests/indices/shrink.yaml index 91359baa6..12784185b 100644 --- a/tests/indices/shrink.yaml +++ b/tests/indices/shrink.yaml @@ -37,13 +37,22 @@ chapters: 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 (wait_for_completion). + version: '>= 2.7' + path: /{index}/_shrink/{target} + method: POST + parameters: + index: movies + target: movies1 + wait_for_completion: true + response: + status: 200 - synopsis: Shrink an index (PUT). path: /{index}/_shrink/{target} method: PUT @@ -53,7 +62,6 @@ chapters: wait_for_active_shards: 1 cluster_manager_timeout: 10s timeout: 10s - wait_for_completion: true response: status: 200 payload: diff --git a/tests/indices/split.yaml b/tests/indices/split.yaml index a4399a984..2c85e8520 100644 --- a/tests/indices/split.yaml +++ b/tests/indices/split.yaml @@ -37,7 +37,6 @@ chapters: wait_for_active_shards: 1 cluster_manager_timeout: 10s timeout: 10s - wait_for_completion: true request_body: payload: settings: @@ -49,6 +48,21 @@ chapters: shards_acknowledged: true acknowledged: true index: movies1 + - synopsis: Split an index (wait_for_completion). + version: '>= 2.7' + path: /{index}/_split/{target} + method: POST + parameters: + index: movies + target: movies1 + wait_for_completion: true + request_body: + payload: + settings: + index: + number_of_shards: 6 + response: + status: 200 - synopsis: Split an index (PUT). path: /{index}/_split/{target} method: PUT @@ -58,7 +72,6 @@ chapters: wait_for_active_shards: 1 cluster_manager_timeout: 10s timeout: 10s - wait_for_completion: true request_body: payload: settings: