Skip to content

Commit

Permalink
Adding spec tests for list APIs
Browse files Browse the repository at this point in the history
Signed-off-by: Harsh Garg <[email protected]>
  • Loading branch information
Harsh Garg committed Oct 18, 2024
1 parent 48935bf commit a8990d3
Show file tree
Hide file tree
Showing 3 changed files with 212 additions and 10 deletions.
20 changes: 10 additions & 10 deletions spec/namespaces/list.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ components:
type: object
properties:
next_token:
type: string
type: ['null', string]
indices:
type: array
items:
Expand All @@ -151,7 +151,7 @@ components:
type: object
properties:
next_token:
type: string
type: ['null', string]
indices:
type: array
items:
Expand All @@ -161,7 +161,7 @@ components:
type: object
properties:
next_token:
type: string
type: ['null', string]
indices:
type: array
items:
Expand All @@ -171,7 +171,7 @@ components:
type: object
properties:
next_token:
type: string
type: ['null', string]
indices:
type: array
items:
Expand All @@ -185,7 +185,7 @@ components:
type: object
properties:
next_token:
type: string
type: ['null', string]
shards:
type: array
items:
Expand All @@ -195,7 +195,7 @@ components:
type: object
properties:
next_token:
type: string
type: ['null', string]
shards:
type: array
items:
Expand All @@ -205,7 +205,7 @@ components:
type: object
properties:
next_token:
type: string
type: ['null', string]
shards:
type: array
items:
Expand All @@ -215,7 +215,7 @@ components:
type: object
properties:
next_token:
type: string
type: ['null', string]
shards:
type: array
items:
Expand Down Expand Up @@ -349,7 +349,7 @@ components:
in: query
description: Token to retrieve next page of indices.
schema:
type: string
type: ['null', string]
description: Token to retrieve next page of indices.
list.indices::query.size:
name: size
Expand Down Expand Up @@ -465,7 +465,7 @@ components:
in: query
description: Token to retrieve next page of shards.
schema:
type: string
type: ['null', string]
description: Token to retrieve next page of shards.
list.shards::query.size:
name: size
Expand Down
151 changes: 151 additions & 0 deletions tests/default/list/indices.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,151 @@
$schema: ../../../json_schemas/test_story.schema.yaml

description: Test _list/indices endpoints.
prologues:
- path: /{index}
method: PUT
parameters:
index: books
request:
payload: {}
- path: /{index}
method: PUT
parameters:
index: unassigned
wait_for_active_shards: 0
request:
payload:
settings:
routing:
allocation:
require:
test: test
epilogues:
- path: /books
method: DELETE
status: [200, 404]
- path: /unassigned
method: DELETE
status: [200, 404]
chapters:
- synopsis: List information related to indexes (text/plain).
version: '>= 2.18'
method: GET
path: /_list/indices
response:
status: 200
content_type: text/plain
- synopsis: List information related to one index (text/plain).
version: '>= 2.18'
method: GET
path: /_list/indices/{index}
parameters:
index: books
response:
status: 200
content_type: text/plain
- synopsis: List information related to indexes with verbose output (v=true).
version: '>= 2.18'
method: GET
path: /_list/indices
parameters:
v: true
response:
status: 200
content_type: text/plain
- synopsis: List information related to indexes with headers (h=header1,header2).
version: '>= 2.18'
method: GET
path: /_list/indices
parameters:
h:
- health
- status
response:
status: 200
content_type: text/plain
- synopsis: List information related to indexes displaying all available headers (help=true).
version: '>= 2.18'
method: GET
path: /_list/indices
parameters:
help: true
response:
status: 200
content_type: text/plain
- synopsis: List information related to indexes with sorted results.
version: '>= 2.18'
method: GET
path: /_list/indices
parameters:
s:
- status
response:
status: 200
content_type: text/plain
- synopsis: List information related to indexes with bytes, time and all fields.
version: '>= 2.18'
method: GET
path: /_list/indices
parameters:
format: json
bytes: b
time: s
h:
- '*'
response:
status: 200
content_type: application/json
- synopsis: List information related to indexes with all fields.
version: '>= 2.18'
method: GET
path: /_list/indices
parameters:
format: json
response:
status: 200
content_type: application/json
- synopsis: List information related to indexes in different formats (format=json).
version: '>= 2.18'
method: GET
path: /_list/indices
parameters:
format: json
response:
status: 200
content_type: application/json
- synopsis: List information related to indexes in different formats (format=yaml).
version: '>= 2.18'
method: GET
path: /_list/indices
parameters:
format: yaml
response:
status: 200
content_type: application/yaml
- synopsis: List information related to indexes in different formats (format=cbor).
version: '>= 2.18'
distributions:
excluded:
- amazon-managed
- amazon-serverless
method: GET
path: /_list/indices
parameters:
format: cbor
response:
status: 200
content_type: application/cbor
- synopsis: List information related to indexes in different formats (format=smile).
version: '>= 2.18'
distributions:
excluded:
- amazon-managed
- amazon-serverless
method: GET
path: /_list/indices
parameters:
format: smile
response:
status: 200
content_type: application/smile
51 changes: 51 additions & 0 deletions tests/default/list/shards.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
$schema: ../../../json_schemas/test_story.schema.yaml

description: Test list/shards endpoints.
prologues:
- path: /{index}
method: PUT
parameters:
index: games
- path: /{index}
method: PUT
parameters:
index: unassigned
wait_for_active_shards: 0
request:
payload:
settings:
routing:
allocation:
require:
test: test
epilogues:
- path: /games
method: DELETE
status: [200, 404]
- path: /unassigned
method: DELETE
status: [200, 404]
chapters:
- synopsis: List the state of all primary and replica shards and how they are distributed.
version: '>= 2.18'
path: /_list/shards
method: GET
parameters:
format: json
h:
- '*'
- synopsis: List the state of all primary and replica shards and how they are distributed for an index.
version: '>= 2.18'
path: /_list/shards/{index}
method: GET
parameters:
format: json
index:
- games
bytes: kb
local: true
time: s
h:
- '*'
response:
status: 200

0 comments on commit a8990d3

Please sign in to comment.