---
setup:
- skip:
    features:
    - "headers"
    - "allowed_warnings_regex"
---
Test cat recovery output:
- requires:
    cluster_features:
    - "gte_v8.0.0"
    reason: "format of bytes output changed in 8.0.0"
- do:
    cat.recovery: {}
    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"
- match:
    $body: "/^$/\n"
- do:
    index:
      index: "index1"
      id: "1"
      body:
        foo: "bar"
      refresh: true
    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:
    cat.recovery:
      h: "i,s,t,ty,st,shost,thost,rep,snap,f,fr,fp,tf,b,br,bp,tb,to,tor,top"
    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"
- match:
    $body: "/^\n(\n  index1      \\s+\n  \\d          \\s+                       \
      \          # shard\n  (?:\\d+ms|\\d+(?:\\.\\d+)?s)    \\s+                 #\
      \ time in ms or seconds\n  (empty_store|existing_store|peer|snapshot|local_shards)\
      \ \\s+ # source type\n  (init|index|verify_index|translog|finalize|done) \\\
      s+ # stage\n  [-\\w.%:/]+  \\s+                                 # source_host\n\
      \  [-\\w.%:/]+  \\s+                                 # target_host\n  [-\\w./]+\
      \    \\s+                                 # repository\n  [-\\w./]+    \\s+\
      \                                 # snapshot\n  \\d+         \\s+          \
      \                       # files\n  \\d+         \\s+                       \
      \          # files_recovered\n  \\d+\\.\\d+%   \\s+                        \
      \         # files_percent\n  \\d+         \\s+                             \
      \    # files_total\n  \\d+(b|kb|mb|gb|tb|pb) \\s+                       # bytes\n\
      \  \\d+(b|kb|mb|gb|tb|pb) \\s+                       # bytes_recovered\n  \\\
      d+\\.\\d+%   \\s+                                 # bytes_percent\n  \\d+(b|kb|mb|gb|tb|pb)\
      \ \\s+                       # bytes_total\n  -?\\d+       \\s+            \
      \                     # translog_ops\n  \\d+         \\s+                  \
      \               # translog_ops_recovered\n  -?\\d+\\.\\d+%                 \
      \                    # translog_ops_percent\n  \\n\n)+\n$/\n"
- do:
    cat.recovery:
      h: "shard,source_node,bytes"
    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"
- match:
    $body: "/^\n(\n  \\d          \\s+                                 # shard\n \
      \ ((\\S+\\s?){1,10})\\s+                             # source_node\n  \\d+(b|kb|mb|gb|tb|pb)\
      \                           # bytes\n  \\n\n)+\n$/\n"
- do:
    cat.recovery:
      h: "shard,target_node,bytes"
    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"
- match:
    $body: "/^\n(\n  \\d          \\s+                                 # shard\n \
      \ ((\\S+\\s?){1,10})\\s+                             # target_node\n  \\d+(b|kb|mb|gb|tb|pb)\
      \                           # bytes\n  \\n\n)+\n$/\n"
---
Test cat recovery output for closed index:
- requires:
    cluster_features:
    - "gte_v8.0.0"
    reason: "format of bytes output changed in 8.0.0"
    test_runner_features:
    - "allowed_warnings"
- do:
    indices.create:
      index: "index2"
      body:
        settings:
          index:
            number_of_replicas: 0
    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:
    indices.close:
      index: "index2"
    allowed_warnings:
    - "the default value for the ?wait_for_active_shards parameter will change from\
      \ '0' to 'index-setting' in version 8; specify '?wait_for_active_shards=index-setting'\
      \ to adopt the future default behaviour, or '?wait_for_active_shards=0' to preserve\
      \ today's behaviour"
    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: "acknowledged"
- do:
    cluster.health:
      index: "index2"
      wait_for_status: "green"
    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:
    cat.recovery:
      index: "index2"
      h: "i,s,t,ty,st,shost,thost,rep,snap,f,fr,fp,tf,b,br,bp,tb,to,tor,top"
    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"
- match:
    $body: "/^\n(\n  index2      \\s+\n  \\d          \\s+                       \
      \          # shard\n  (?:\\d+ms|\\d+(?:\\.\\d+)?s)    \\s+                 #\
      \ time in ms or seconds\n  existing_store \\s+                             \
      \ # source type (always existing_store for closed indices)\n  done        \\\
      s+                                 # stage\n  [-\\w.%:/]+  \\s+            \
      \                     # source_host\n  [-\\w.%:/]+  \\s+                   \
      \              # target_host\n  [-\\w./]+    \\s+                          \
      \       # repository\n  [-\\w./]+    \\s+                                 #\
      \ snapshot\n  \\d+         \\s+                                 # files\n  \\\
      d+         \\s+                                 # files_recovered\n  \\d+\\\
      .\\d+%   \\s+                                 # files_percent\n  \\d+      \
      \   \\s+                                 # files_total\n  \\d+(b|kb|mb|gb|tb|pb)\
      \ \\s+                       # bytes\n  \\d+(b|kb|mb|gb|tb|pb) \\s+        \
      \               # bytes_recovered\n  \\d+\\.\\d+%   \\s+                   \
      \              # bytes_percent\n  \\d+(b|kb|mb|gb|tb|pb) \\s+              \
      \         # bytes_total\n  0          \\s+                                 \
      \ # translog_ops (always 0 for closed indices)\n  0           \\s+         \
      \                        # translog_ops_recovered (always 0 for closed indices)\n\
      \  100\\.0%                                         # translog_ops_percent (always\
      \ 100.0% for closed indices)\n  \\n\n)+\n$/\n"
