Skip to content

Commit

Permalink
Fixed prologue warnings.
Browse files Browse the repository at this point in the history
Signed-off-by: dblock <[email protected]>
  • Loading branch information
dblock committed Jul 31, 2024
1 parent 18a321c commit 3c22d39
Show file tree
Hide file tree
Showing 24 changed files with 247 additions and 159 deletions.
2 changes: 1 addition & 1 deletion TESTING_GUIDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ For example, an ML task returns `CREATED` when created, and `COMPLETED` when it'
The test runner expects all tests in the same file to be variation of the same path in order to keep tests well-organized. Otherwise, a warning will be emitted.
```
WARNING Multiple paths detected, please group similar tests together and move paths not being tested to the prologue.
WARNING Multiple paths detected, please group similar tests together and move paths not being tested to prologues or epilogues.
/_component_template/{name}
/_index_template/{name}
/{index}
Expand Down
1 change: 1 addition & 0 deletions json_schemas/test_story.schema.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -189,4 +189,5 @@ definitions:
multiple-paths-detected:
type: boolean
default: true
description: Enable/disable warnings about multiple paths being tested in the same story.
additionalProperties: false
4 changes: 4 additions & 0 deletions tests/_core/reindex/pipeline.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,15 @@ chapters:
response:
status: 200
- synopsis: Refresh the index.
warnings:
multiple-paths-detected: false
path: /{index}/_refresh
method: POST
parameters:
index: videos
- synopsis: Get all videos.
warnings:
multiple-paths-detected: false
path: /{index}/_search
method: POST
parameters:
Expand Down
36 changes: 36 additions & 0 deletions tests/cat/pit_segments/all.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
$schema: ../../../json_schemas/test_story.schema.yaml

description: Test cat/pit_segments/_all endpoints.
version: '>= 2.4'
epilogues:
- path: /games
method: DELETE
status: [200, 404]
prologues:
- path: /games/_doc
method: POST
parameters:
refresh: true
request_body:
payload:
title: Monopoly
status: [201]
- id: create_pit
path: /{index}/_search/point_in_time
method: POST
parameters:
index:
- games
keep_alive: 1m
output:
pit_id: payload.pit_id
chapters:
- synopsis: Cat _all with a json response.
path: /_cat/pit_segments/_all
method: GET
parameters:
format: json
response:
status: 200
payload:
- index: games
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
$schema: ../../json_schemas/test_story.schema.yaml
$schema: ../../../json_schemas/test_story.schema.yaml

description: Test cat/pit_segments endpoints.
version: '>= 2.4'
Expand All @@ -15,9 +15,7 @@ prologues:
payload:
title: Monopoly
status: [201]
chapters:
- synopsis: Create a PIT.
id: create_pit
- id: create_pit
path: /{index}/_search/point_in_time
method: POST
parameters:
Expand All @@ -26,15 +24,7 @@ chapters:
keep_alive: 1m
output:
pit_id: payload.pit_id
- synopsis: Cat _all with a json response.
path: /_cat/pit_segments/_all
method: GET
parameters:
format: json
response:
status: 200
payload:
- index: games
chapters:
- synopsis: Cat pit_segments/pit_id with a json response.
path: /_cat/pit_segments
method: GET
Expand Down
12 changes: 4 additions & 8 deletions tests/cat/snapshots.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,18 @@ $schema: ../../json_schemas/test_story.schema.yaml

description: Test cat/snapshots endpoints.
epilogues:
- path: /_snapshot/{repository}
- path: /_snapshot/my-fs-repository
method: DELETE
status: [200, 404]
parameters:
repository: my-fs-repository
chapters:
- synopsis: Create a snapshot repository.
path: /_snapshot/{repository}
prologues:
- path: /_snapshot/my-fs-repository
method: PUT
parameters:
repository: my-fs-repository
request_body:
payload:
type: fs
settings:
location: /tmp/opensearch/repo
chapters:
- synopsis: Cat with a json response.
path: /_cat/snapshots/{repository}
method: GET
Expand Down
68 changes: 68 additions & 0 deletions tests/indices/alias/alias.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
$schema: ../../../json_schemas/test_story.schema.yaml

description: Test alias endpoints.
epilogues:
- path: /games
method: DELETE
status: [200, 404]
prologues:
- path: /{index}
method: PUT
parameters:
index: games
chapters:
- synopsis: Create an alias.
path: /{index}/_alias/{name}
method: PUT
parameters:
index: games
name: jeux
- synopsis: Get an alias from index.
method: GET
path: /{index}/_alias/{name}
parameters:
index: games
name: jeux
response:
status: 200
content_type: application/json
payload:
games:
aliases:
jeux: {}
- synopsis: Delete an alias.
path: /{index}/_alias/{name}
method: DELETE
parameters:
index: games
name: jeux
- synopsis: Create an alias by Create or Update alias endpoint.
path: /{index}/_alias/{name}
method: PUT
parameters:
index: games
name: jeux
- synopsis: Create an alias with custom settings by Create or Update alias endpoint.
path: /{index}/_alias/{name}
method: PUT
parameters:
index: games
name: jeux
request_body:
payload:
index_routing: test1
search_routing: test2
routing: test
is_write_index: true
filter:
match_all: {}
- synopsis: Create an alias with is_hidden by Create or Update alias endpoint.
version: '>= 2.16'
path: /{index}/_alias/{name}
method: PUT
parameters:
index: games
name: jeux
request_body:
payload:
is_hidden: true
67 changes: 2 additions & 65 deletions tests/indices/aliases/aliases.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,42 +6,15 @@ epilogues:
method: DELETE
status: [200, 404]
prologues:
- path: /{index}
- path: games
method: PUT
parameters:
index: games
chapters:
- synopsis: Create an alias.
path: /{index}/_aliases/{name}
method: PUT
parameters:
index: games
name: jeux
- synopsis: Get an alias from index.
method: GET
path: /{index}/_alias/{name}
parameters:
index: games
name: jeux
response:
status: 200
content_type: application/json
payload:
games:
aliases:
jeux: {}
- synopsis: Get an alias from _aliases.
method: GET
path: /_alias/{name}
parameters:
name: jeux
response:
status: 200
content_type: application/json
payload:
games:
aliases:
jeux: {}
- synopsis: Multiple alias operations.
path: /_aliases
method: POST
Expand All @@ -61,45 +34,9 @@ chapters:
status: 200
payload:
acknowledged: true
- synopsis: Delete an alias from _aliases.
- synopsis: Delete an alias.
path: /{index}/_aliases/{name}
method: DELETE
parameters:
index: games
name: plays1
- synopsis: Delete an alias from _alias.
path: /{index}/_alias/{name}
method: DELETE
parameters:
index: games
name: plays2
- synopsis: Create an alias by Create or Update alias endpoint.
path: /{index}/_alias/{name}
method: PUT
parameters:
index: games
name: jeux
- synopsis: Create an alias with custom settings by Create or Update alias endpoint.
path: /{index}/_alias/{name}
method: PUT
parameters:
index: games
name: jeux
request_body:
payload:
index_routing: test1
search_routing: test2
routing: test
is_write_index: true
filter:
match_all: {}
- synopsis: Create an alias with is_hidden by Create or Update alias endpoint.
version: '>= 2.16'
path: /{index}/_alias/{name}
method: PUT
parameters:
index: games
name: jeux
request_body:
payload:
is_hidden: true
15 changes: 6 additions & 9 deletions tests/indices/clone.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@ description: Test cloning an index.
prologues:
- path: /movies
method: PUT
- path: /movies/_settings
method: PUT
request_body:
payload:
settings:
index.blocks.write: true
epilogues:
- path: /movies
method: DELETE
Expand All @@ -18,15 +24,6 @@ epilogues:
method: DELETE
status: [200, 404]
chapters:
- synopsis: Block writes to the source index.
path: /{index}/_settings
method: PUT
parameters:
index: movies
request_body:
payload:
settings:
index.blocks.write: true
- synopsis: Clone an index.
path: /{index}/_clone/{target}
method: POST
Expand Down
8 changes: 8 additions & 0 deletions tests/indices/component_template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ chapters:
response:
status: 200
- synopsis: Create an index template composed of 2 component templates.
warnings:
multiple-paths-detected: false
path: /_index_template/{name}
method: POST
parameters:
Expand Down Expand Up @@ -82,20 +84,26 @@ chapters:
response:
status: 200
- synopsis: Create an index using the composite template.
warnings:
multiple-paths-detected: false
path: /{index}
method: PUT
parameters:
index: logs-2020-01-01
response:
status: 200
- synopsis: Get an index using the composite template.
warnings:
multiple-paths-detected: false
path: /{index}
method: GET
parameters:
index: logs-2020-01-01
response:
status: 200
- synopsis: Delete index template.
warnings:
multiple-paths-detected: false
path: /_index_template/{name}
method: DELETE
parameters:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
$schema: ../../json_schemas/test_story.schema.yaml
$schema: ../../../json_schemas/test_story.schema.yaml

description: Test data streams.
prologues:
Expand Down Expand Up @@ -27,6 +27,8 @@ chapters:
parameters:
name: logs-nginx
- synopsis: Ingest data.
warnings:
multiple-paths-detected: false
path: /{index}/_doc
method: POST
parameters:
Expand All @@ -42,16 +44,6 @@ chapters:
method: GET
parameters:
name: logs-nginx
- synopsis: Get data stream stats.
path: /_data_stream/{name}/_stats
method: GET
parameters:
name: logs-nginx
- synopsis: Manually roll over a data stream.
path: /{alias}/_rollover
method: POST
parameters:
alias: logs-nginx
- synopsis: Get all data streams.
path: /_data_stream
method: GET
Expand Down
Loading

0 comments on commit 3c22d39

Please sign in to comment.