Skip to content

Commit

Permalink
Require response in tests.
Browse files Browse the repository at this point in the history
Signed-off-by: dblock <[email protected]>
  • Loading branch information
dblock committed Aug 13, 2024
1 parent 42fd4d7 commit b7686a4
Show file tree
Hide file tree
Showing 16 changed files with 67 additions and 14 deletions.
2 changes: 1 addition & 1 deletion json_schemas/test_story.schema.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ definitions:
$ref: '#/definitions/ExpectedResponse'
warnings:
$ref: '#/definitions/Warnings'
required: [synopsis]
required: [response, synopsis]

ReadChapter:
allOf:
Expand Down
5 changes: 4 additions & 1 deletion tests/default/_core/bulk.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ chapters:
payload:
- {create: {_index: movies}}
- {director: Bennett Miller, title: Moneyball, year: 2011}
response:
status: 200
- synopsis: Bulk document CRUD.
path: /_bulk
method: POST
Expand All @@ -31,4 +33,5 @@ chapters:
- {update: {_index: books, _id: does_not_exist}}
- {script: {source: 'ctx.op = "none";'}, scripted_upsert: true, upsert: {pages: 375}}
- {delete: {_index: books, _id: book_1392214}}

response:
status: 200
2 changes: 2 additions & 0 deletions tests/default/_core/reindex/pipeline.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ chapters:
method: POST
parameters:
index: videos
response:
status: 200
- synopsis: Get all videos.
warnings:
multiple-paths-detected: false
Expand Down
2 changes: 2 additions & 0 deletions tests/default/_core/search/match.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ chapters:
match:
director:
query: Bennett Miller
response:
status: 200
- synopsis: Search with a match query field.
path: /{index}/_search
parameters:
Expand Down
2 changes: 2 additions & 0 deletions tests/default/cat/shards.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ chapters:
method: GET
parameters:
format: json
response:
status: 200
- synopsis: Cat index shards with a json response.
path: /_cat/shards/{index}
method: GET
Expand Down
2 changes: 2 additions & 0 deletions tests/default/cluster/component_template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -101,3 +101,5 @@ chapters:
method: DELETE
parameters:
name: template1
response:
status: 200
10 changes: 10 additions & 0 deletions tests/default/indices/alias/alias.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ chapters:
parameters:
index: games
name: jeux
response:
status: 200
- synopsis: Get an alias from index.
method: GET
path: /{index}/_alias/{name}
Expand All @@ -36,12 +38,16 @@ chapters:
parameters:
index: games
name: jeux
response:
status: 200
- synopsis: Create an alias by Create or Update alias endpoint.
path: /{index}/_alias/{name}
method: PUT
parameters:
index: games
name: jeux
response:
status: 200
- synopsis: Create an alias with custom settings by Create or Update alias endpoint.
path: /{index}/_alias/{name}
method: PUT
Expand All @@ -56,6 +62,8 @@ chapters:
is_write_index: true
filter:
match_all: {}
response:
status: 200
- synopsis: Create an alias with is_hidden by Create or Update alias endpoint.
version: '>= 2.16'
path: /{index}/_alias/{name}
Expand All @@ -66,3 +74,5 @@ chapters:
request:
payload:
is_hidden: true
response:
status: 200
4 changes: 4 additions & 0 deletions tests/default/indices/aliases/aliases.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ chapters:
parameters:
index: games
name: jeux
response:
status: 200
- synopsis: Multiple alias operations.
path: /_aliases
method: POST
Expand All @@ -40,3 +42,5 @@ chapters:
parameters:
index: games
name: plays1
response:
status: 200
2 changes: 2 additions & 0 deletions tests/default/indices/dangling.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,5 @@ chapters:
- synopsis: Get dangling indexes.
path: /_dangling
method: GET
response:
status: 200
8 changes: 8 additions & 0 deletions tests/default/indices/data_stream/data_stream.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ chapters:
method: PUT
parameters:
name: logs-nginx
response:
status: 200
- synopsis: Ingest data.
warnings:
multiple-paths-detected: false
Expand All @@ -44,11 +46,17 @@ chapters:
method: GET
parameters:
name: logs-nginx
response:
status: 200
- synopsis: Get all data streams.
path: /_data_stream
method: GET
response:
status: 200
- synopsis: Delete a data stream.
path: /_data_stream/{name}
method: DELETE
parameters:
name: logs-nginx
response:
status: 200
2 changes: 2 additions & 0 deletions tests/default/indices/data_stream/rollover.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,5 @@ chapters:
method: POST
parameters:
alias: logs-nginx
response:
status: 200
2 changes: 2 additions & 0 deletions tests/default/indices/data_stream/stats.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,5 @@ chapters:
method: GET
parameters:
name: logs-nginx
response:
status: 200
12 changes: 11 additions & 1 deletion tests/default/indices/index.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ chapters:
method: PUT
parameters:
index: games
response:
status: 200

- synopsis: Check if the index `books` exists. It should.
path: /{index}
Expand All @@ -45,6 +47,8 @@ chapters:
include_defaults: true
ignore_unavailable: true
local: true
response:
status: 200

- synopsis: Check if the index `movies` exists. It should not.
path: /{index}
Expand All @@ -70,13 +74,17 @@ chapters:
parameters:
index: books,games
flat_settings: true
response:
status: 200

- synopsis: Delete the `books` and `games` indices.
path: /{index}
method: DELETE
version: < 2.0
parameters:
index: books,games
response:
status: 200

- synopsis: Delete the `books` index (cluster_manager_timeout).
path: /{index}
Expand All @@ -85,4 +93,6 @@ chapters:
parameters:
index: books,games
cluster_manager_timeout: 10s

response:
status: 200

2 changes: 2 additions & 0 deletions tests/default/indices/settings.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ chapters:
index.blocks.write: true
index:
number_of_replicas: 4
response:
status: 200
- synopsis: Get settings for an index.
path: /{index}/_settings
method: GET
Expand Down
4 changes: 4 additions & 0 deletions tests/default/ml/models.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ chapters:
id: register_model
path: /_plugins/_ml/models/_register
method: POST
warnings:
multiple-paths-detected: false
request:
payload:
name: huggingface/sentence-transformers/msmarco-distilbert-base-tas-b
Expand Down Expand Up @@ -47,3 +49,5 @@ chapters:
parameters:
model_id: ${get_completed_task.model_id}
method: DELETE
response:
status: 200
20 changes: 9 additions & 11 deletions tests/default/security/api/certificates.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,18 @@ description: Test certificates endpoints.
version: '> 2.14'

# ADMIN-CERT only. These tests require explicit rest api admin privileges.
chapters:
- synopsis: Get node.
id: get_node
path: /_cat/nodes
prologues:
- path: /_cat/nodes
id: node
method: GET
parameters:
h:
- id
full_id: true
response:
status: 200
content_type: text/plain
size: 1
format: json
h: id
output:
node_id: payload
id: payload[0].id
chapters:
- synopsis: Get all certificates.
path: /_plugins/_security/api/certificates
method: GET
Expand All @@ -29,7 +27,7 @@ chapters:
path: /_plugins/_security/api/certificates/{node_id}
method: GET
parameters:
node_id: ${get_node.node_id}
node_id: ${node.id}
cert_type: all
response:
status: 403

0 comments on commit b7686a4

Please sign in to comment.