diff --git a/spec/namespaces/indices.yaml b/spec/namespaces/indices.yaml index 9c524871c..b1175e56b 100644 --- a/spec/namespaces/indices.yaml +++ b/spec/namespaces/indices.yaml @@ -2393,15 +2393,22 @@ components: content: application/json: schema: - type: object - properties: - acknowledged: - type: boolean - shards_acknowledged: - type: boolean - required: - - acknowledged - - shards_acknowledged + oneOf: + - type: object + properties: + task: + $ref: '../schemas/_common.yaml#/components/schemas/TaskId' + additionalProperties: false + - type: object + properties: + acknowledged: + type: boolean + shards_acknowledged: + type: boolean + required: + - acknowledged + - shards_acknowledged + additionalProperties: false indices.put_alias@200: description: '' content: @@ -2995,7 +3002,7 @@ components: To target all data streams in a cluster, omit this parameter or use `*`. required: true schema: - $ref: '../schemas/_common.yaml#/components/schemas/Indices' + $ref: '../schemas/_common.yaml#/components/schemas/IndexName' style: simple indices.delete::path.index: in: path diff --git a/tests/indices/close.yaml b/tests/indices/close.yaml new file mode 100644 index 000000000..0766f3085 --- /dev/null +++ b/tests/indices/close.yaml @@ -0,0 +1,38 @@ +$schema: ../../json_schemas/test_story.schema.yaml + +description: Test closing an index. +prologues: + - path: /movies + method: PUT + status: [200] +epilogues: + - path: /movies + method: DELETE + status: [200, 404] +chapters: + - synopsis: Close an index. + path: /{index}/_close + 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 + response: + status: 200 + payload: + indices: + movies: + closed: true + - synopsis: Close an already closed index. + path: /{index}/_close + method: POST + parameters: + index: movies + response: + status: 200 + payload: + indices: {} diff --git a/tests/indices/_doc.yaml b/tests/indices/doc.yaml similarity index 100% rename from tests/indices/_doc.yaml rename to tests/indices/doc.yaml diff --git a/tests/indices/open.yaml b/tests/indices/open.yaml new file mode 100644 index 000000000..dbcade065 --- /dev/null +++ b/tests/indices/open.yaml @@ -0,0 +1,63 @@ +$schema: ../../json_schemas/test_story.schema.yaml + +description: Test opening an index. +prologues: + - path: /movies + method: PUT + status: [200] + - path: /games + method: PUT + status: [200] + - path: /movies/_close + method: POST + status: [200] + - path: /games/_close + method: POST + status: [200] +epilogues: + - path: /movies,games + method: DELETE + status: [200, 404] +chapters: + - synopsis: Open a closed index. + 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: true + response: + status: 200 + payload: + shards_acknowledged: true + acknowledged: true + - synopsis: Open a closed index (wait_for_completion=false). + 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. + path: /{index}/_open + method: POST + parameters: + index: movies + response: + status: 200 + payload: + shards_acknowledged: true + acknowledged: true diff --git a/tools/src/tester/ChapterReader.ts b/tools/src/tester/ChapterReader.ts index 7cb5219e7..3a5b6d815 100644 --- a/tools/src/tester/ChapterReader.ts +++ b/tools/src/tester/ChapterReader.ts @@ -61,7 +61,7 @@ export default class ChapterReader { response.message = payload.error?.reason ?? e.response.statusText response.error = e - this.logger.info(`<= ${response.status} (${response.content_type}) | ${response.payload ?? response.message}`) + this.logger.info(`<= ${response.status} (${response.content_type}) | ${to_json(response.payload ?? response.message)}`) }) return response as ActualResponse }