Skip to content

Commit

Permalink
Test against OpenSearch 1.3.17. (#424)
Browse files Browse the repository at this point in the history
Signed-off-by: dblock <[email protected]>
  • Loading branch information
dblock authored Jul 16, 2024
1 parent 9c15bbf commit 0c59033
Show file tree
Hide file tree
Showing 21 changed files with 237 additions and 13 deletions.
1 change: 1 addition & 0 deletions .github/workflows/test-spec.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ jobs:
strategy:
matrix:
entry:
- {version: 1.3.17, admin_password: admin}
- {version: 2.0.0, admin_password: admin}
- {version: 2.15.0}
- {version: 2.16.0, hub: opensearchstaging}
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
- Added `cluster_manager_timeout` to `HEAD /{index}` ([#421](https://github.com/opensearch-project/opensearch-api-specification/pull/421))
- Added missing fields to `/_nodes/stats` ([#415](https://github.com/opensearch-project/opensearch-api-specification/pull/415))
- Added missing metrics options to `/_nodes/stats` ([#422](https://github.com/opensearch-project/opensearch-api-specification/pull/422))
- Added tests against OpenSearch 1.3 ([#424](https://github.com/opensearch-project/opensearch-api-specification/pull/424))

### Changed

Expand Down
5 changes: 5 additions & 0 deletions spec/schemas/_common.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ info:
paths: {}
components:
schemas:
Type:
type: string
x-version-removed: '2.0'
Id:
type: string
AcknowledgedResponseBase:
Expand Down Expand Up @@ -1315,6 +1318,8 @@ components:
WriteResponseBase:
type: object
properties:
_type:
$ref: '#/components/schemas/Type'
_id:
$ref: '#/components/schemas/Id'
_index:
Expand Down
4 changes: 4 additions & 0 deletions spec/schemas/_core.bulk.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,10 @@ components:
ResponseItem:
type: object
properties:
_type:
description: The document type.
type: string
x-version-removed: '2.0'
_id:
description: The document ID associated with the operation.
anyOf:
Expand Down
2 changes: 2 additions & 0 deletions spec/schemas/_core.get.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ components:
GetResult:
type: object
properties:
_type:
$ref: '_common.yaml#/components/schemas/Type'
_index:
$ref: '_common.yaml#/components/schemas/IndexName'
fields:
Expand Down
2 changes: 2 additions & 0 deletions spec/schemas/_core.search.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ components:
Hit:
type: object
properties:
_type:
$ref: '_common.yaml#/components/schemas/Type'
_index:
$ref: '_common.yaml#/components/schemas/IndexName'
_id:
Expand Down
4 changes: 4 additions & 0 deletions spec/schemas/cat.health.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -52,3 +52,7 @@ components:
discovered_cluster_manager:
description: cluster manager is discovered or not
type: string
discovered_master:
x-version-removed: '2.0'
description: cluster manager is discovered or not
type: string
1 change: 1 addition & 0 deletions tests/cat/cluster_manager.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ $schema: ../../json_schemas/test_story.schema.yaml
description: Test cat/cluster_manager endpoints.
chapters:
- synopsis: Cat with a json response.
version: '>= 2.0'
path: /_cat/cluster_manager
method: GET
parameters:
Expand Down
30 changes: 27 additions & 3 deletions tests/cat/health.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,33 @@ chapters:
- synopsis: Cat in different formats (format=json).
method: GET
path: /_cat/health
parameters:
format: json
response:
status: 200
content_type: application/json
payload:
- node.total: '1'
status: yellow
node.data: '1'
- synopsis: Cat with master response (format=json).
method: GET
path: /_cat/health
version: < 2.0
parameters:
format: json
response:
status: 200
content_type: application/json
payload:
- node.total: '1'
status: yellow
node.data: '1'
discovered_master: 'true'
- synopsis: Cat with cluster_manager response (format=json).
method: GET
path: /_cat/health
version: '>= 2.0'
parameters:
format: json
response:
Expand All @@ -68,7 +95,6 @@ chapters:
- node.total: '1'
status: yellow
node.data: '1'
discovered_cluster_manager: 'true'
- synopsis: Cat in different formats (format=cbor).
method: GET
path: /_cat/health
Expand All @@ -81,7 +107,6 @@ chapters:
- node.total: '1'
status: yellow
node.data: '1'
discovered_cluster_manager: 'true'
- synopsis: Cat in different formats (format=smile).
method: GET
path: /_cat/health
Expand All @@ -94,4 +119,3 @@ chapters:
- node.total: '1'
status: yellow
node.data: '1'
discovered_cluster_manager: 'true'
12 changes: 12 additions & 0 deletions tests/cat/master.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
$schema: ../../json_schemas/test_story.schema.yaml

description: Test cat/master endpoints.
chapters:
- synopsis: Cat with a json response.
version: < 2.0
path: /_cat/master
method: GET
parameters:
format: json
response:
status: 200
11 changes: 11 additions & 0 deletions tests/cat/nodes.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,17 @@ chapters:
- synopsis: Cat with a json response.
path: /_cat/nodes
method: GET
version: < 2.0
parameters:
format: json
response:
status: 200
payload:
- master: '*'
- synopsis: Cat with a json response.
path: /_cat/nodes
version: '>= 2.0'
method: GET
parameters:
format: json
response:
Expand Down
18 changes: 17 additions & 1 deletion tests/cluster/component_template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -53,13 +53,29 @@ chapters:
method: HEAD
parameters:
name: template1
cluster_manager_timeout: 10s
local: false
response:
status: 200
- synopsis: Check if the component template exists (cluster_manager_timeout).
path: /_component_template/{name}
method: HEAD
version: '>= 2.0'
parameters:
name: template1
cluster_manager_timeout: 10s
response:
status: 200
- synopsis: Get all component templates.
path: /_component_template
method: GET
parameters:
local: false
response:
status: 200
- synopsis: Get all component templates (cluster_manager_timeout).
path: /_component_template
method: GET
version: '>= 2.0'
parameters:
cluster_manager_timeout: 10s
local: false
Expand Down
14 changes: 13 additions & 1 deletion tests/indices/clone.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ epilogues:
- path: /games2
method: DELETE
status: [200, 404]
- path: /games3
method: DELETE
status: [200, 404]
chapters:
- synopsis: Block writes to the source index.
path: /{index}/_settings
Expand All @@ -31,7 +34,6 @@ chapters:
index: movies
target: games1
wait_for_active_shards: 1
cluster_manager_timeout: 10s
timeout: 10s
response:
status: 200
Expand All @@ -49,3 +51,13 @@ chapters:
wait_for_completion: true
response:
status: 200
- synopsis: Clone an index (cluster_manager_timeout).
version: '>= 2.0'
path: /{index}/_clone/{target}
method: POST
parameters:
index: movies
target: games3
cluster_manager_timeout: 10s
response:
status: 200
21 changes: 20 additions & 1 deletion tests/indices/close.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,16 @@ prologues:
- path: /movies
method: PUT
status: [200]
- path: /games
method: PUT
status: [200]
epilogues:
- path: /movies
method: DELETE
status: [200, 404]
- path: /games
method: DELETE
status: [200, 404]
chapters:
- synopsis: Close an index.
path: /{index}/_close
Expand All @@ -19,14 +25,27 @@ chapters:
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 index (cluster_manager_timeout).
path: /{index}/_close
method: POST
version: '>= 2.0'
parameters:
index: games
cluster_manager_timeout: 30s
timeout: 30s
response:
status: 200
payload:
indices:
games:
closed: true
- synopsis: Close an already closed index.
path: /{index}/_close
method: POST
Expand Down
18 changes: 18 additions & 0 deletions tests/indices/index.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,15 @@ chapters:
- synopsis: Check if the index `movies` exists. It should not.
path: /{index}
method: HEAD
parameters:
index: movies
response:
status: 404

- synopsis: Check if the index `movies` exists (cluster_manager_timeout). It should not.
path: /{index}
method: HEAD
version: '>= 2.0'
parameters:
index: movies
cluster_manager_timeout: 10s
Expand Down Expand Up @@ -77,6 +86,15 @@ chapters:
- synopsis: Delete the `books` and `games` indices.
path: /{index}
method: DELETE
version: < 2.0
parameters:
index: books,games

- synopsis: Delete the `books` index (cluster_manager_timeout).
path: /{index}
method: DELETE
version: '>= 2.0'
parameters:
index: books,games
cluster_manager_timeout: 10s

8 changes: 8 additions & 0 deletions tests/indices/index_template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,14 @@ chapters:
- synopsis: Check that an index template exists.
path: /_index_template/{name}
method: HEAD
parameters:
name: daily_logs
response:
status: 200
- synopsis: Check that an index template exists (cluster_manager_timeout).
path: /_index_template/{name}
method: HEAD
version: '>= 2.0'
parameters:
name: daily_logs
cluster_manager_timeout: 10s
Expand Down
17 changes: 16 additions & 1 deletion tests/indices/mapping.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@ chapters:
allow_no_indices: true
expand_wildcards: none
ignore_unavailable: true
cluster_manager_timeout: 1s
timeout: 10s
write_index_only: true
request_body:
Expand All @@ -78,3 +77,19 @@ chapters:
status: 200
payload:
acknowledged: true
- synopsis: Update mapping for an index (cluster_manager_timeout).
path: /{index}/_mapping
method: PUT
version: '>= 2.0'
parameters:
index: movies
cluster_manager_timeout: 1s
request_body:
payload:
properties:
producer:
type: text
response:
status: 200
payload:
acknowledged: true
21 changes: 19 additions & 2 deletions tests/indices/open.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,20 @@ prologues:
- path: /games
method: PUT
status: [200]
- path: /films
method: PUT
status: [200]
- path: /movies/_close
method: POST
status: [200]
- path: /games/_close
method: POST
status: [200]
- path: /films/_close
method: POST
status: [200]
epilogues:
- path: /movies,games
- path: /movies,games,films
method: DELETE
status: [200, 404]
chapters:
Expand All @@ -28,7 +34,6 @@ chapters:
expand_wildcards: all
ignore_unavailable: true
wait_for_active_shards: 0
cluster_manager_timeout: 30s
timeout: 30s
response:
status: 200
Expand All @@ -54,3 +59,15 @@ chapters:
payload:
shards_acknowledged: true
acknowledged: true
- synopsis: Open a closed index (cluster_manager_timeout).
path: /{index}/_open
method: POST
version: '>= 2.0'
parameters:
index: films
cluster_manager_timeout: 30s
response:
status: 200
payload:
shards_acknowledged: true
acknowledged: true
Loading

0 comments on commit 0c59033

Please sign in to comment.