---
setup:
- skip:
    features:
    - "arbitrary_key"
    - "headers"
    - "allowed_warnings_regex"
---
node_reload_secure_settings test wrong password:
- requires:
    cluster_features:
    - "gte_v7.7.0"
    reason: "support for reloading password protected keystores was introduced in\
      \ 7.7.0"
- do:
    nodes.reload_secure_settings:
      node_id: "_local"
      body:
        secure_settings_password: "awrongpasswordhere"
    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"
- set:
    nodes._arbitrary_key_: "node_id"
- is_true: "nodes"
- is_true: "cluster_name"
- match:
    nodes.$node_id.reload_exception.type: "security_exception"
- match:
    nodes.$node_id.reload_exception.reason: "/^(Provided\\skeystore\\spassword\\swas\\\
      sincorrect| Keystore\\shas\\sbeen\\scorrupted\\sor\\stampered\\swith)$/"
---
node_reload_secure_settings test correct(empty) password:
- skip:
    features: "fips_140"
    reason: "In FIPS 140 mode, we use a password protected elasticsearch keystore"
- do:
    nodes.reload_secure_settings: {}
    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"
- set:
    nodes._arbitrary_key_: "node_id"
- is_true: "nodes"
- is_true: "cluster_name"
- is_false: "nodes.$node_id.reload_exception"
