[ML][TEST] Add BWC tests for rules syntax change
Original commit: elastic/x-pack-elasticsearch@805d390417
This commit is contained in:
parent
50ea5f9cf8
commit
621f4f20b0
|
@ -94,3 +94,11 @@ setup:
|
|||
- do:
|
||||
xpack.ml.close_job:
|
||||
job_id: mixed-cluster-job
|
||||
|
||||
---
|
||||
"Test get job with rules":
|
||||
|
||||
- do:
|
||||
xpack.ml.get_jobs:
|
||||
job_id: old-cluster-job-with-rules
|
||||
- match: { count: 1 }
|
||||
|
|
|
@ -121,3 +121,77 @@
|
|||
"time_format":"epoch"
|
||||
}
|
||||
}
|
||||
|
||||
---
|
||||
"Test job with pre 6.2 rules":
|
||||
|
||||
- skip:
|
||||
version: "6.2.0 - "
|
||||
reason: "Rules fields were renamed on 6.2.0"
|
||||
|
||||
- do:
|
||||
xpack.ml.put_job:
|
||||
job_id: old-cluster-job-with-rules
|
||||
body: >
|
||||
{
|
||||
"analysis_config": {
|
||||
"detectors": [
|
||||
{
|
||||
"function": "count",
|
||||
"by_field_name": "country",
|
||||
"detector_rules": [
|
||||
{
|
||||
"rule_action": "filter_results",
|
||||
"rule_conditions": [
|
||||
{
|
||||
"condition_type":"numerical_actual",
|
||||
"field_name":"country",
|
||||
"field_value": "uk",
|
||||
"condition": {"operator":"lt","value":"33.3"}
|
||||
},
|
||||
{"type":"categorical", "field_name":"country", "value_filter": "foo"}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
"data_description" : {}
|
||||
}
|
||||
|
||||
---
|
||||
"Test job with post 6.2 rules":
|
||||
|
||||
- skip:
|
||||
version: " - 6.1.99"
|
||||
reason: "Rules fields were renamed on 6.2.0"
|
||||
|
||||
- do:
|
||||
xpack.ml.put_job:
|
||||
job_id: old-cluster-job-with-rules
|
||||
body: >
|
||||
{
|
||||
"analysis_config": {
|
||||
"detectors": [
|
||||
{
|
||||
"function": "count",
|
||||
"by_field_name": "country",
|
||||
"rules": [
|
||||
{
|
||||
"actions": ["filter_results"],
|
||||
"conditions": [
|
||||
{
|
||||
"type":"numerical_actual",
|
||||
"field_name":"country",
|
||||
"field_value": "uk",
|
||||
"condition": {"operator":"lt","value":"33.3"}
|
||||
},
|
||||
{"type":"categorical", "field_name":"country", "filter_id": "foo"}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
"data_description" : {}
|
||||
}
|
||||
|
|
|
@ -97,3 +97,27 @@ setup:
|
|||
job_id: no-model-memory-limit-job
|
||||
- match: { acknowledged: true }
|
||||
|
||||
---
|
||||
"Test get job with rules":
|
||||
|
||||
- do:
|
||||
xpack.ml.get_jobs:
|
||||
job_id: old-cluster-job-with-rules
|
||||
- match: { count: 1 }
|
||||
- match: {
|
||||
jobs.0.analysis_config.detectors.0.rules: [
|
||||
{
|
||||
"actions": ["filter_results"],
|
||||
"conditions_connective": "or",
|
||||
"conditions": [
|
||||
{
|
||||
"type":"numerical_actual",
|
||||
"field_name":"country",
|
||||
"field_value": "uk",
|
||||
"condition": {"operator":"lt","value":"33.3"}
|
||||
},
|
||||
{"type":"categorical", "field_name":"country", "filter_id": "foo"}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue