elastic / rally

Macrobenchmarking framework for Elasticsearch
Apache License 2.0
1.95k stars 313 forks source link

Inject serverless_operator in track templates #1787

Closed gbanasiak closed 12 months ago

gbanasiak commented 1 year ago

Logical continuation of https://github.com/elastic/rally/pull/1750 with additional global variable serverless_operator. The variable holds true if Rally detects serverless cluster and operator privileges, and false otherwise.

I've extended unit tests to cover the addition. For manual tests I've used custom track definition with the following bits:

# track json
{% import "rally.helpers" as rally with context %}
{
  "version": 2,
  [..]
  "indices": [
    {
      "name": "test-index",
      "body": "test-index.json"
    }
  ],
[..]

# test-index.json
{
    "mappings": {
      [..]
    },
    "settings": {
        "index": {
{% if build_flavor != "serverless" or serverless_operator %}
            "number_of_replicas": "{{number_of_replicas | default(0)}}",
            "number_of_shards": "{{number_of_shards | default(2)}}"
{% endif %}
        }
    }
}