---
setup:
- skip:
    features:
    - "headers"
    - "allowed_warnings_regex"
---
Diagnosis:
- requires:
    cluster_features: "gte_v8.7.0"
    reason: "the API path changed in 8.7"
- do:
    indices.create:
      index: "red_index"
      master_timeout: "1s"
      timeout: "1s"
      body:
        settings:
          number_of_shards: 1
          number_of_replicas: 0
          index.routing.allocation.enable: "none"
    headers:
      Content-Type: "application/vnd.elasticsearch+json;compatible-with=8"
      Accept: "application/vnd.elasticsearch+json;compatible-with=8"
    allowed_warnings_regex:
    - "Use of the \\[max_size\\] rollover condition has been deprecated in favour\
      \ of the \\[max_primary_shard_size\\] condition and will be removed in a later\
      \ version"
    - "Parameter \\[confidence_interval\\] in \\[index_options\\] for dense_vector\
      \ field \\[[^\\]]+\\] is deprecated and will be removed in a future version"
- do:
    health_report:
      feature: "shards_availability"
    headers:
      Content-Type: "application/vnd.elasticsearch+json;compatible-with=8"
      Accept: "application/vnd.elasticsearch+json;compatible-with=8"
    allowed_warnings_regex:
    - "Use of the \\[max_size\\] rollover condition has been deprecated in favour\
      \ of the \\[max_primary_shard_size\\] condition and will be removed in a later\
      \ version"
    - "Parameter \\[confidence_interval\\] in \\[index_options\\] for dense_vector\
      \ field \\[[^\\]]+\\] is deprecated and will be removed in a future version"
- is_true: "cluster_name"
- match:
    indicators.shards_availability.status: "red"
- match:
    indicators.shards_availability.symptom: "This cluster has 1 unavailable primary\
      \ shard."
- is_true: "indicators.shards_availability.diagnosis"
- length:
    indicators.shards_availability.diagnosis: 1
- is_true: "indicators.shards_availability.diagnosis.0.affected_resources"
- length:
    indicators.shards_availability.diagnosis.0.affected_resources: 1
- match:
    indicators.shards_availability.diagnosis.0.affected_resources.indices.0: "red_index"
