---
setup:
- skip:
    features:
    - "headers"
    - "allowed_warnings_regex"
---
teardown:
- skip:
    features:
    - "headers"
    - "allowed_warnings_regex"
- do:
    cluster.put_settings:
      body:
        persistent:
          xpack.ml.max_model_memory_limit: null
    headers:
      Content-Type: "application/vnd.elasticsearch+json;compatible-with=8"
      Accept: "application/vnd.elasticsearch+json;compatible-with=8"
    allowed_warnings_regex:
    - ".*rollup functionality will be removed in Elasticsearch.*"
    - "Index \\[\\.profiling-.*\\] name begins with a dot.* and will not be allowed\
      \ in a future Elasticsearch version."
    - "Parameter \\[default_metric\\] is deprecated and will be removed in a future\
      \ version"
---
Test ml info:
- do:
    ml.info: {}
    headers:
      Content-Type: "application/vnd.elasticsearch+json;compatible-with=8"
      Accept: "application/vnd.elasticsearch+json;compatible-with=8"
    allowed_warnings_regex:
    - ".*rollup functionality will be removed in Elasticsearch.*"
    - "Index \\[\\.profiling-.*\\] name begins with a dot.* and will not be allowed\
      \ in a future Elasticsearch version."
    - "Parameter \\[default_metric\\] is deprecated and will be removed in a future\
      \ version"
- match:
    defaults.anomaly_detectors.categorization_analyzer.tokenizer: "ml_standard"
- match:
    defaults.anomaly_detectors.model_memory_limit: "1gb"
- match:
    defaults.anomaly_detectors.categorization_examples_limit: 4
- match:
    defaults.anomaly_detectors.model_snapshot_retention_days: 10
- match:
    defaults.anomaly_detectors.daily_model_snapshot_retention_after_days: 1
- match:
    defaults.datafeeds.scroll_size: 1000
- is_false: "limits.max_model_memory_limit"
- match:
    limits.effective_max_model_memory_limit: "/\\d+[kmg]?b/"
- match:
    limits.total_ml_memory: "/\\d+mb/"
- match:
    upgrade_mode: false
- do:
    cluster.put_settings:
      body:
        persistent:
          xpack.ml.max_model_memory_limit: "512mb"
    headers:
      Content-Type: "application/vnd.elasticsearch+json;compatible-with=8"
      Accept: "application/vnd.elasticsearch+json;compatible-with=8"
    allowed_warnings_regex:
    - ".*rollup functionality will be removed in Elasticsearch.*"
    - "Index \\[\\.profiling-.*\\] name begins with a dot.* and will not be allowed\
      \ in a future Elasticsearch version."
    - "Parameter \\[default_metric\\] is deprecated and will be removed in a future\
      \ version"
- do:
    ml.info: {}
    headers:
      Content-Type: "application/vnd.elasticsearch+json;compatible-with=8"
      Accept: "application/vnd.elasticsearch+json;compatible-with=8"
    allowed_warnings_regex:
    - ".*rollup functionality will be removed in Elasticsearch.*"
    - "Index \\[\\.profiling-.*\\] name begins with a dot.* and will not be allowed\
      \ in a future Elasticsearch version."
    - "Parameter \\[default_metric\\] is deprecated and will be removed in a future\
      \ version"
- match:
    defaults.anomaly_detectors.categorization_analyzer.tokenizer: "ml_standard"
- match:
    defaults.anomaly_detectors.model_memory_limit: "512mb"
- match:
    defaults.anomaly_detectors.categorization_examples_limit: 4
- match:
    defaults.anomaly_detectors.model_snapshot_retention_days: 10
- match:
    defaults.anomaly_detectors.daily_model_snapshot_retention_after_days: 1
- match:
    defaults.datafeeds.scroll_size: 1000
- match:
    limits.max_model_memory_limit: "512mb"
- match:
    limits.effective_max_model_memory_limit: "/\\d+[kmg]?b/"
- match:
    limits.total_ml_memory: "/\\d+mb/"
- match:
    upgrade_mode: false
- do:
    cluster.put_settings:
      body:
        persistent:
          xpack.ml.max_model_memory_limit: "6gb"
    headers:
      Content-Type: "application/vnd.elasticsearch+json;compatible-with=8"
      Accept: "application/vnd.elasticsearch+json;compatible-with=8"
    allowed_warnings_regex:
    - ".*rollup functionality will be removed in Elasticsearch.*"
    - "Index \\[\\.profiling-.*\\] name begins with a dot.* and will not be allowed\
      \ in a future Elasticsearch version."
    - "Parameter \\[default_metric\\] is deprecated and will be removed in a future\
      \ version"
- do:
    ml.info: {}
    headers:
      Content-Type: "application/vnd.elasticsearch+json;compatible-with=8"
      Accept: "application/vnd.elasticsearch+json;compatible-with=8"
    allowed_warnings_regex:
    - ".*rollup functionality will be removed in Elasticsearch.*"
    - "Index \\[\\.profiling-.*\\] name begins with a dot.* and will not be allowed\
      \ in a future Elasticsearch version."
    - "Parameter \\[default_metric\\] is deprecated and will be removed in a future\
      \ version"
- match:
    defaults.anomaly_detectors.categorization_analyzer.tokenizer: "ml_standard"
- match:
    defaults.anomaly_detectors.model_memory_limit: "1gb"
- match:
    defaults.anomaly_detectors.categorization_examples_limit: 4
- match:
    defaults.anomaly_detectors.model_snapshot_retention_days: 10
- match:
    defaults.anomaly_detectors.daily_model_snapshot_retention_after_days: 1
- match:
    defaults.datafeeds.scroll_size: 1000
- match:
    limits.max_model_memory_limit: "6gb"
- match:
    limits.effective_max_model_memory_limit: "/\\d+[kmg]?b/"
- match:
    limits.total_ml_memory: "/\\d+mb/"
- match:
    upgrade_mode: false
- do:
    cluster.put_settings:
      body:
        persistent:
          xpack.ml.max_model_memory_limit: "6gb"
    headers:
      Content-Type: "application/vnd.elasticsearch+json;compatible-with=8"
      Accept: "application/vnd.elasticsearch+json;compatible-with=8"
    allowed_warnings_regex:
    - ".*rollup functionality will be removed in Elasticsearch.*"
    - "Index \\[\\.profiling-.*\\] name begins with a dot.* and will not be allowed\
      \ in a future Elasticsearch version."
    - "Parameter \\[default_metric\\] is deprecated and will be removed in a future\
      \ version"
- do:
    ml.info: {}
    headers:
      Content-Type: "application/vnd.elasticsearch+json;compatible-with=8"
      Accept: "application/vnd.elasticsearch+json;compatible-with=8"
    allowed_warnings_regex:
    - ".*rollup functionality will be removed in Elasticsearch.*"
    - "Index \\[\\.profiling-.*\\] name begins with a dot.* and will not be allowed\
      \ in a future Elasticsearch version."
    - "Parameter \\[default_metric\\] is deprecated and will be removed in a future\
      \ version"
- match:
    defaults.anomaly_detectors.categorization_analyzer.tokenizer: "ml_standard"
- match:
    defaults.anomaly_detectors.model_memory_limit: "1gb"
- match:
    defaults.anomaly_detectors.categorization_examples_limit: 4
- match:
    defaults.anomaly_detectors.model_snapshot_retention_days: 10
- match:
    defaults.anomaly_detectors.daily_model_snapshot_retention_after_days: 1
- match:
    defaults.datafeeds.scroll_size: 1000
- match:
    limits.max_model_memory_limit: "6gb"
- match:
    limits.effective_max_model_memory_limit: "/\\d+[kmg]?b/"
- match:
    limits.total_ml_memory: "/\\d+mb/"
- match:
    upgrade_mode: false
- do:
    cluster.put_settings:
      body:
        persistent:
          xpack.ml.max_model_memory_limit: "1mb"
    headers:
      Content-Type: "application/vnd.elasticsearch+json;compatible-with=8"
      Accept: "application/vnd.elasticsearch+json;compatible-with=8"
    allowed_warnings_regex:
    - ".*rollup functionality will be removed in Elasticsearch.*"
    - "Index \\[\\.profiling-.*\\] name begins with a dot.* and will not be allowed\
      \ in a future Elasticsearch version."
    - "Parameter \\[default_metric\\] is deprecated and will be removed in a future\
      \ version"
- do:
    ml.info: {}
    headers:
      Content-Type: "application/vnd.elasticsearch+json;compatible-with=8"
      Accept: "application/vnd.elasticsearch+json;compatible-with=8"
    allowed_warnings_regex:
    - ".*rollup functionality will be removed in Elasticsearch.*"
    - "Index \\[\\.profiling-.*\\] name begins with a dot.* and will not be allowed\
      \ in a future Elasticsearch version."
    - "Parameter \\[default_metric\\] is deprecated and will be removed in a future\
      \ version"
- match:
    defaults.anomaly_detectors.categorization_analyzer.tokenizer: "ml_standard"
- match:
    defaults.anomaly_detectors.model_memory_limit: "1mb"
- match:
    defaults.anomaly_detectors.categorization_examples_limit: 4
- match:
    defaults.anomaly_detectors.model_snapshot_retention_days: 10
- match:
    defaults.anomaly_detectors.daily_model_snapshot_retention_after_days: 1
- match:
    defaults.datafeeds.scroll_size: 1000
- match:
    limits.max_model_memory_limit: "1mb"
- match:
    limits.effective_max_model_memory_limit: "1mb"
- match:
    limits.total_ml_memory: "/\\d+mb/"
- match:
    upgrade_mode: false
