Skip to content

Commit

Permalink
Added tests for component_template.
Browse files Browse the repository at this point in the history
Signed-off-by: dblock <[email protected]>
  • Loading branch information
dblock committed Jul 12, 2024
1 parent 188413c commit 68d68de
Show file tree
Hide file tree
Showing 4 changed files with 100 additions and 12 deletions.
87 changes: 87 additions & 0 deletions tests/cluster/component_template.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
$schema: ../../json_schemas/test_story.schema.yaml

description: Test component templates.
epilogues:
- path: /_component_template/template1
method: DELETE
status: [200, 404]
chapters:
- synopsis: Create a component template.
path: /_component_template/{name}
method: POST
parameters:
name: template1
request_body:
payload:
template:
settings:
number_of_shards: 1
mappings:
_source:
enabled: false
properties:
name:
type: keyword
age:
type: integer
response:
status: 200
- synopsis: Update a component template.
path: /_component_template/{name}
method: PUT
parameters:
name: template1
request_body:
payload:
template:
settings:
number_of_shards: 2
mappings:
_source:
enabled: false
properties:
name:
type: keyword
age:
type: integer
aliases:
alias1: {}
response:
status: 200
- synopsis: Check if the component template exists.
path: /_component_template/{name}
method: HEAD
parameters:
name: template1
cluster_manager_timeout: 10s
local: false
response:
status: 200
- synopsis: Get all component templates.
path: /_component_template
method: GET
parameters:
cluster_manager_timeout: 10s
local: false
response:
status: 200
- synopsis: Get a component template.
path: /_component_template/{name}
method: GET
parameters:
name: template1
response:
status: 200
payload:
component_templates:
- name: template1
component_template:
template:
settings:
index:
number_of_shards: '2'
- synopsis: Delete the component template.
path: /_component_template/{name}
method: DELETE
parameters:
name: template1
22 changes: 10 additions & 12 deletions tests/indices/data_stream.yaml
Original file line number Diff line number Diff line change
@@ -1,19 +1,9 @@
$schema: ../../json_schemas/test_story.schema.yaml

description: Test data streams.
epilogues:
- path: /_data_stream/logs-nginx
method: DELETE
status: [200, 404]
- path: /_index_template/logs-template
method: DELETE
status: [200, 404]
chapters:
- synopsis: Create an index template.
path: /_index_template/{name}
prologues:
- path: /_index_template/logs-template-nginx
method: PUT
parameters:
name: logs-template-nginx
request_body:
payload:
index_patterns:
Expand All @@ -23,6 +13,14 @@ chapters:
timestamp_field:
name: request_time
priority: 100
epilogues:
- path: /_data_stream/logs-nginx
method: DELETE
status: [200, 404]
- path: /_index_template/logs-template
method: DELETE
status: [200, 404]
chapters:
- synopsis: Create a data stream.
path: /_data_stream/{name}
method: PUT
Expand Down
2 changes: 2 additions & 0 deletions tests/indices/index.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ chapters:
method: HEAD
parameters:
index: movies
cluster_manager_timeout: 10s
response:
status: 404

Expand Down Expand Up @@ -78,3 +79,4 @@ chapters:
method: DELETE
parameters:
index: books,games
cluster_manager_timeout: 10s
1 change: 1 addition & 0 deletions tests/indices/index_template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ chapters:
method: HEAD
parameters:
name: daily_logs
cluster_manager_timeout: 10s
response:
status: 200
- synopsis: Delete an index template.
Expand Down

0 comments on commit 68d68de

Please sign in to comment.