Skip to content

Commit

Permalink
Use correct params for create component template (#1690)
Browse files Browse the repository at this point in the history
The Elasticsearch Python client does not accept a request body but
rather requires parts of the body to be passed for the create component
template API call. With this commit we adapt Rally to these changes.
  • Loading branch information
danielmitterdorfer authored Mar 29, 2023
1 parent 462a2f1 commit f3f4865
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions esrally/driver/runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -1454,8 +1454,8 @@ class CreateComponentTemplate(Runner):
async def __call__(self, es, params):
templates = mandatory(params, "templates", self)
request_params = mandatory(params, "request-params", self)
for template, body in templates:
await es.cluster.put_component_template(name=template, body=body, params=request_params)
for name, body in templates:
await es.cluster.put_component_template(name=name, template=body["template"], params=request_params)
return {
"weight": len(templates),
"unit": "ops",
Expand Down
4 changes: 2 additions & 2 deletions tests/driver/runner_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -2992,12 +2992,12 @@ async def test_create_index_templates(self, es):
[
mock.call(
name="templateA",
body={"template": {"mappings": {"properties": {"@timestamp": {"type": "date"}}}}},
template={"mappings": {"properties": {"@timestamp": {"type": "date"}}}},
params=params["request-params"],
),
mock.call(
name="templateB",
body={"template": {"settings": {"index.number_of_shards": 1, "index.number_of_replicas": 1}}},
template={"settings": {"index.number_of_shards": 1, "index.number_of_replicas": 1}},
params=params["request-params"],
),
]
Expand Down

0 comments on commit f3f4865

Please sign in to comment.