[TEST] Fix YAML tests for single type and new id changes

Original commit: elastic/x-pack-elasticsearch@a3b2bd6643
This commit is contained in:
Dimitrios Athanasiou 2017-05-26 15:43:15 +01:00
parent 9ed06ba15e
commit 8ec9427196
8 changed files with 50 additions and 104 deletions

View File

@ -25,8 +25,8 @@ setup:
- do:
index:
index: mlresults-custom-all-test-1
type: result
index: .ml-anomalies-custom-all-test-1
type: doc
id: custom_all_1464739200000_1_1
body:
{
@ -34,7 +34,7 @@ setup:
"result_type": "record",
"timestamp": "2016-06-01T00:00:00Z",
"anomaly_score": 60.0,
"bucket_span": "1s",
"bucket_span": 1,
"by_field_value": "A by field",
"partition_field_value": "A partition field",
"over_field_value": "An over field",
@ -49,76 +49,76 @@ setup:
- do:
index:
index: mlresults-custom-all-test-2
type: result
index: .ml-anomalies-custom-all-test-2
type: doc
id: custom_all_1464739200000_1_2
body:
{
"job_id": "custom-all-test-2",
"result_type": "record",
"timestamp": "2016-06-01T00:00:00Z",
"bucket_span": "1s",
"bucket_span": 1,
"by_field_value": "A by field"
}
- do:
indices.refresh:
index: [mlresults-custom-all-test-1, mlresults-custom-all-test-2]
index: [.ml-anomalies-shared]
---
"Test querying custom all field":
- do:
search:
index: mlresults-custom-all-test-1
index: .ml-anomalies-custom-all-test-1
body: { query: { query_string: { query: "A by field" } } }
- match: { hits.total: 1 }
- do:
search:
index: mlresults-custom-all-test-1
index: .ml-anomalies-custom-all-test-1
body: { query: { query_string: { query: "A partition field" } } }
- match: { hits.total: 1 }
- do:
search:
index: mlresults-custom-all-test-1
index: .ml-anomalies-custom-all-test-1
body: { query: { query_string: { query: "An over field" } } }
- match: { hits.total: 1 }
- do:
search:
index: mlresults-custom-all-test-1
index: .ml-anomalies-custom-all-test-1
body: { query: { query_string: { query: "An influencer field" } } }
- match: { hits.total: 1 }
- do:
search:
index: mlresults-custom-all-test-1
index: .ml-anomalies-custom-all-test-1
body: { query: { query_string: { query: "Cause by field" } } }
- match: { hits.total: 1 }
- do:
search:
index: mlresults-custom-all-test-1
index: .ml-anomalies-custom-all-test-1
body: { query: { query_string: { query: "Cause partition field" } } }
- match: { hits.total: 1 }
- do:
search:
index: mlresults-custom-all-test-1
index: .ml-anomalies-custom-all-test-1
body: { query: { query_string: { query: "Cause over field" } } }
- match: { hits.total: 1 }
- do:
search:
index: mlresults-custom-all-test-1
index: .ml-anomalies-custom-all-test-1
body: { query: { query_string: { query: "Cause correlated by field" } } }
- match: { hits.total: 1 }
- do:
search:
index: mlresults-custom-all-test-1
index: .ml-anomalies-custom-all-test-1
body: { query: { query_string: { query: "custom-all-test-1" } } }
- match: { hits.total: 1 }
@ -128,7 +128,7 @@ setup:
- do:
search:
body: { query: { bool: { must: [
{ query_string: { query: "_type:result AND result_type:record"} },
{ query_string: { query: "result_type:record"} },
{ query_string: { query: "A by field" } },
{ query_string: { query: "job_id:*" } }
] } } }

View File

@ -44,8 +44,8 @@ setup:
- do:
index:
index: .ml-state
type: model_state
id: "delete-model-snapshot-inactive-snapshot#1"
type: doc
id: "delete-model-snapshot_model_state_inactive-snapshot#1"
body: >
{
"state": "a"
@ -54,8 +54,8 @@ setup:
- do:
index:
index: .ml-state
type: model_state
id: "delete-model-snapshot-inactive-snapshot#2"
type: doc
id: "delete-model-snapshot_model_state_inactive-snapshot#2"
body: >
{
"state": "b"
@ -117,9 +117,9 @@ setup:
- do:
count:
index: .ml-state
type: model_state
type: doc
- match: { count: 2 }
- match: { count: 3 }
- do:
xpack.ml.delete_model_snapshot:
@ -144,9 +144,9 @@ setup:
- do:
count:
index: .ml-state
type: model_state
type: doc
- match: { count: 0 }
- match: { count: 1 }
---
"Test delete with in-use model":

View File

@ -16,7 +16,7 @@ setup:
- do:
index:
index: .ml-anomalies-get-model-snapshots
type: model_snapshot
type: doc
id: "get-model-snapshots-1"
body: >
{
@ -29,7 +29,7 @@ setup:
- do:
index:
index: .ml-anomalies-get-model-snapshots
type: model_snapshot
type: doc
id: "get-model-snapshots-2"
body: >
{

View File

@ -157,16 +157,16 @@
- do:
index:
index: .ml-state
type: categorizer_state
id: index-layout-job2#1
type: doc
id: index-layout-job2_categorizer_state#1
body:
key: value
- do:
index:
index: .ml-state
type: categorizer_state
id: index-layout-job2#2
type: doc
id: index-layout-job2_categorizer_state#2
body:
key: value
@ -254,19 +254,19 @@
- do:
count:
type: categorizer_state
type: doc
index: .ml-state
- match: {count: 0}
- do:
count:
type: quantiles
type: doc
index: .ml-state
- match: {count: 0}
- do:
count:
type: model_state
type: doc
index: .ml-state
- match: {count: 0}
@ -325,21 +325,21 @@
- do:
index:
index: foo
type: foo
type: doc
body:
key: value
- do:
index:
index: .ml-anomalies-foo
type: foo
type: doc
body:
key: value
- do:
index:
index: .ml-anomalies-foo
type: foo
type: doc
body:
key: value
job_id: foo
@ -403,7 +403,7 @@
- match: {count: 2}
---
"Test delete removes 5.4 and 5.5 quantiles":
"Test delete removes quantiles":
- do:
xpack.ml.put_job:
@ -428,14 +428,6 @@
body:
state: quantile-state
- do:
index:
index: .ml-state
type: quantiles
id: index-layout-quantiles-job-quantiles
body:
state: quantile-state
- do:
indices.refresh: {}
@ -453,7 +445,7 @@
- match: {count: 0}
---
"Test delete removes 5.4 and 5.5 state":
"Test delete removes state":
- do:
xpack.ml.put_job:
@ -485,20 +477,6 @@
"retain": false
}
- do:
index:
index: .ml-anomalies-shared
type: model_snapshot
id: "index-layout-state-job-456"
body: >
{
"job_id" : "index-layout-state-job",
"timestamp": "2017-05-01T00:00:00Z",
"snapshot_id": "456",
"snapshot_doc_count": 2,
"retain": false
}
- do:
index:
index: .ml-state
@ -515,22 +493,6 @@
body:
state: more-new-model-state
- do:
index:
index: .ml-state
type: model_state
id: index-layout-state-job-456#1
body:
state: old-model-state
- do:
index:
index: .ml-state
type: model_state
id: index-layout-state-job-456#2
body:
state: more-old-model-state
- do:
index:
index: .ml-state
@ -547,22 +509,6 @@
body:
state: more-new-categorizer-state
- do:
index:
index: .ml-state
type: categorizer_state
id: index-layout-state-job#1
body:
state: old-categorizer-state
- do:
index:
index: .ml-state
type: categorizer_state
id: index-layout-state-job#2
body:
state: more-old-categorizer-state
- do:
indices.refresh: {}

View File

@ -16,7 +16,7 @@ setup:
- do:
index:
index: .ml-anomalies-jobs-get-result-buckets
type: result
type: doc
id: "jobs-get-result-buckets_1464739200000_1"
body:
{
@ -30,7 +30,7 @@ setup:
- do:
index:
index: .ml-anomalies-jobs-get-result-buckets
type: result
type: doc
id: "jobs-get-result-buckets_1470009600000_2"
body:
{
@ -44,7 +44,7 @@ setup:
- do:
index:
index: .ml-anomalies-jobs-get-result-buckets
type: result
type: doc
id: "jobs-get-result-buckets_1470096000000_3"
body:
{

View File

@ -16,19 +16,19 @@ setup:
- do:
index:
index: .ml-anomalies-jobs-get-result-categories
type: category_definition
type: doc
id: jobs-get-result-categories-1
body: { "job_id": "jobs-get-result-categories", "category_id": 1 }
- do:
index:
index: .ml-anomalies-jobs-get-result-categories
type: category_definition
type: doc
id: jobs-get-result-categories-2
body: { "job_id": "jobs-get-result-categories", "category_id": 2 }
- do:
index:
index: .ml-anomalies-unrelated
type: category_definition
type: doc
id: jobs-get-result-categories-3
body: { "job_id": "unrelated", "category_id": 1 }

View File

@ -16,7 +16,7 @@ setup:
- do:
index:
index: .ml-anomalies-get-influencers-test
type: result
type: doc
id: get-influencers-test_1464739200000_1_1
body:
{
@ -32,7 +32,7 @@ setup:
- do:
index:
index: .ml-anomalies-get-influencers-test
type: result
type: doc
id: get-influencers-test_1464825600000_1_2
body:
{
@ -49,7 +49,7 @@ setup:
- do:
index:
index: .ml-anomalies-get-influencers-test
type: result
type: doc
id: get-influencers-test_1464912000000_1_3
body:
{

View File

@ -16,7 +16,7 @@ setup:
- do:
index:
index: .ml-anomalies-jobs-get-result-records
type: result
type: doc
id: jobs-get-result-records_1464739200000_1_1
body:
{
@ -30,7 +30,7 @@ setup:
- do:
index:
index: .ml-anomalies-jobs-get-result-records
type: result
type: doc
id: jobs-get-result-records_1464825600000_1_2
body:
{