[ML] Fix model snapshot YAML tests
Original commit: elastic/x-pack-elasticsearch@e29663da35
This commit is contained in:
parent
6c97ac7691
commit
c49a17e7ca
|
@ -29,12 +29,12 @@ setup:
|
||||||
index:
|
index:
|
||||||
index: .ml-anomalies-foo
|
index: .ml-anomalies-foo
|
||||||
type: model_snapshot
|
type: model_snapshot
|
||||||
id: "foo1"
|
id: "foo-inactive-snapshot"
|
||||||
body: >
|
body: >
|
||||||
{
|
{
|
||||||
"job_id": "foo",
|
"job_id": "foo",
|
||||||
"timestamp": "2016-06-02T00:00:00Z",
|
"timestamp": "2016-06-02T00:00:00Z",
|
||||||
"snapshot_id": "foo1",
|
"snapshot_id": "inactive-snapshot",
|
||||||
"description": "first",
|
"description": "first",
|
||||||
"latest_record_time_stamp": "2016-06-02T00:00:00Z",
|
"latest_record_time_stamp": "2016-06-02T00:00:00Z",
|
||||||
"latest_result_time_stamp": "2016-06-02T00:00:00Z",
|
"latest_result_time_stamp": "2016-06-02T00:00:00Z",
|
||||||
|
@ -45,32 +45,32 @@ setup:
|
||||||
index:
|
index:
|
||||||
index: .ml-state
|
index: .ml-state
|
||||||
type: model_state
|
type: model_state
|
||||||
id: "foo1_0"
|
id: "foo-inactive-snapshot_1"
|
||||||
body: >
|
body: >
|
||||||
{
|
{
|
||||||
"state": "foo"
|
"state": "a"
|
||||||
}
|
}
|
||||||
|
|
||||||
- do:
|
- do:
|
||||||
index:
|
index:
|
||||||
index: .ml-state
|
index: .ml-state
|
||||||
type: model_state
|
type: model_state
|
||||||
id: "foo1_1"
|
id: "foo-inactive-snapshot_2"
|
||||||
body: >
|
body: >
|
||||||
{
|
{
|
||||||
"state": "foo"
|
"state": "b"
|
||||||
}
|
}
|
||||||
|
|
||||||
- do:
|
- do:
|
||||||
index:
|
index:
|
||||||
index: .ml-anomalies-foo
|
index: .ml-anomalies-foo
|
||||||
type: model_snapshot
|
type: model_snapshot
|
||||||
id: "foo2"
|
id: "foo-active-snapshot"
|
||||||
body: >
|
body: >
|
||||||
{
|
{
|
||||||
"job_id": "foo",
|
"job_id": "foo",
|
||||||
"timestamp": "2016-06-01T00:00:00Z",
|
"timestamp": "2016-06-01T00:00:00Z",
|
||||||
"snapshot_id": "foo2",
|
"snapshot_id": "active-snapshot",
|
||||||
"description": "second",
|
"description": "second",
|
||||||
"latest_record_time_stamp": "2016-06-01T00:00:00Z",
|
"latest_record_time_stamp": "2016-06-01T00:00:00Z",
|
||||||
"latest_result_time_stamp": "2016-06-01T00:00:00Z"
|
"latest_result_time_stamp": "2016-06-01T00:00:00Z"
|
||||||
|
@ -84,6 +84,14 @@ setup:
|
||||||
indices.refresh:
|
indices.refresh:
|
||||||
index: .ml-anomalies-foo
|
index: .ml-anomalies-foo
|
||||||
|
|
||||||
|
- do:
|
||||||
|
xpack.ml.update_job:
|
||||||
|
job_id: foo
|
||||||
|
body: >
|
||||||
|
{
|
||||||
|
"model_snapshot_id": "active-snapshot"
|
||||||
|
}
|
||||||
|
|
||||||
---
|
---
|
||||||
"Test delete snapshot missing snapshotId":
|
"Test delete snapshot missing snapshotId":
|
||||||
- do:
|
- do:
|
||||||
|
@ -96,7 +104,7 @@ setup:
|
||||||
- do:
|
- do:
|
||||||
catch: param
|
catch: param
|
||||||
xpack.ml.delete_model_snapshot:
|
xpack.ml.delete_model_snapshot:
|
||||||
snapshot_id: "foo"
|
snapshot_id: "inactive-snapshot"
|
||||||
|
|
||||||
---
|
---
|
||||||
"Test valid delete snapshot":
|
"Test valid delete snapshot":
|
||||||
|
@ -115,7 +123,7 @@ setup:
|
||||||
- do:
|
- do:
|
||||||
xpack.ml.delete_model_snapshot:
|
xpack.ml.delete_model_snapshot:
|
||||||
job_id: "foo"
|
job_id: "foo"
|
||||||
snapshot_id: "foo1"
|
snapshot_id: "inactive-snapshot"
|
||||||
- match: { acknowledged: true }
|
- match: { acknowledged: true }
|
||||||
|
|
||||||
- do:
|
- do:
|
||||||
|
@ -130,7 +138,7 @@ setup:
|
||||||
xpack.ml.get_model_snapshots:
|
xpack.ml.get_model_snapshots:
|
||||||
job_id: "foo"
|
job_id: "foo"
|
||||||
- match: { count: 1 }
|
- match: { count: 1 }
|
||||||
- match: { model_snapshots.0.snapshot_id: "foo2"}
|
- match: { model_snapshots.0.snapshot_id: "active-snapshot"}
|
||||||
|
|
||||||
- do:
|
- do:
|
||||||
count:
|
count:
|
||||||
|
@ -141,13 +149,9 @@ setup:
|
||||||
|
|
||||||
---
|
---
|
||||||
"Test delete with in-use model":
|
"Test delete with in-use model":
|
||||||
- do:
|
|
||||||
xpack.ml.revert_model_snapshot:
|
|
||||||
job_id: "foo"
|
|
||||||
snapshot_id: "foo2"
|
|
||||||
|
|
||||||
- do:
|
- do:
|
||||||
catch: request
|
catch: request
|
||||||
xpack.ml.delete_model_snapshot:
|
xpack.ml.delete_model_snapshot:
|
||||||
job_id: "foo"
|
job_id: "foo"
|
||||||
snapshot_id: "foo2"
|
snapshot_id: "active-snapshot"
|
||||||
|
|
|
@ -34,7 +34,8 @@ setup:
|
||||||
job_id: "foo"
|
job_id: "foo"
|
||||||
|
|
||||||
- match: { count: 2 }
|
- match: { count: 2 }
|
||||||
- match: { model_snapshots.0.timestamp: 1464739200000 }
|
- match: { model_snapshots.0.timestamp: 1464825600000 }
|
||||||
|
- match: { model_snapshots.1.timestamp: 1464739200000 }
|
||||||
|
|
||||||
---
|
---
|
||||||
"Test get model snapshots API with _all":
|
"Test get model snapshots API with _all":
|
||||||
|
@ -44,7 +45,8 @@ setup:
|
||||||
snapshot_id: "_all"
|
snapshot_id: "_all"
|
||||||
|
|
||||||
- match: { count: 2 }
|
- match: { count: 2 }
|
||||||
- match: { model_snapshots.0.timestamp: 1464739200000 }
|
- match: { model_snapshots.0.timestamp: 1464825600000 }
|
||||||
|
- match: { model_snapshots.1.timestamp: 1464739200000 }
|
||||||
|
|
||||||
---
|
---
|
||||||
"Test get specific model snapshot":
|
"Test get specific model snapshot":
|
||||||
|
@ -65,7 +67,8 @@ setup:
|
||||||
end: "2016-07-01T00:00:00Z"
|
end: "2016-07-01T00:00:00Z"
|
||||||
|
|
||||||
- match: { count: 2 }
|
- match: { count: 2 }
|
||||||
- match: { model_snapshots.0.timestamp: 1464739200000 }
|
- match: { model_snapshots.0.timestamp: 1464825600000 }
|
||||||
|
- match: { model_snapshots.1.timestamp: 1464739200000 }
|
||||||
|
|
||||||
---
|
---
|
||||||
"Test get model snapshots API with ascending":
|
"Test get model snapshots API with ascending":
|
||||||
|
@ -75,7 +78,8 @@ setup:
|
||||||
desc: false
|
desc: false
|
||||||
|
|
||||||
- match: { count: 2 }
|
- match: { count: 2 }
|
||||||
- match: { model_snapshots.0.timestamp: 1464825600000 }
|
- match: { model_snapshots.0.timestamp: 1464739200000 }
|
||||||
|
- match: { model_snapshots.1.timestamp: 1464825600000 }
|
||||||
|
|
||||||
---
|
---
|
||||||
"Test get model snapshots API with size":
|
"Test get model snapshots API with size":
|
||||||
|
@ -85,7 +89,7 @@ setup:
|
||||||
size: 1
|
size: 1
|
||||||
|
|
||||||
- match: { count: 2 }
|
- match: { count: 2 }
|
||||||
- match: { model_snapshots.0.timestamp: 1464739200000 }
|
- match: { model_snapshots.0.timestamp: 1464825600000 }
|
||||||
- length: { model_snapshots: 1 }
|
- length: { model_snapshots: 1 }
|
||||||
|
|
||||||
---
|
---
|
||||||
|
@ -96,5 +100,5 @@ setup:
|
||||||
from: 1
|
from: 1
|
||||||
|
|
||||||
- match: { count: 2 }
|
- match: { count: 2 }
|
||||||
- match: { model_snapshots.0.timestamp: 1464825600000 }
|
- match: { model_snapshots.0.timestamp: 1464739200000 }
|
||||||
- length: { model_snapshots: 1 }
|
- length: { model_snapshots: 1 }
|
||||||
|
|
|
@ -29,13 +29,13 @@ setup:
|
||||||
index:
|
index:
|
||||||
index: .ml-anomalies-foo
|
index: .ml-anomalies-foo
|
||||||
type: model_snapshot
|
type: model_snapshot
|
||||||
id: "1"
|
id: "foo-first"
|
||||||
body: >
|
body: >
|
||||||
{
|
{
|
||||||
"job_id": "foo",
|
"job_id": "foo",
|
||||||
"timestamp": "2016-06-02T00:00:00Z",
|
"timestamp": "2016-06-02T00:00:00Z",
|
||||||
"snapshot_id": "foo1",
|
"snapshot_id": "first",
|
||||||
"description": "first",
|
"description": "first snapshot",
|
||||||
"latest_record_time_stamp": "2016-06-02T00:00:00Z",
|
"latest_record_time_stamp": "2016-06-02T00:00:00Z",
|
||||||
"latest_result_time_stamp": "2016-06-02T00:00:00Z"
|
"latest_result_time_stamp": "2016-06-02T00:00:00Z"
|
||||||
}
|
}
|
||||||
|
@ -44,13 +44,13 @@ setup:
|
||||||
index:
|
index:
|
||||||
index: .ml-anomalies-foo
|
index: .ml-anomalies-foo
|
||||||
type: model_snapshot
|
type: model_snapshot
|
||||||
id: "2"
|
id: "foo-second"
|
||||||
body: >
|
body: >
|
||||||
{
|
{
|
||||||
"job_id": "foo",
|
"job_id": "foo",
|
||||||
"timestamp": "2016-06-01T00:00:00Z",
|
"timestamp": "2016-06-01T00:00:00Z",
|
||||||
"snapshot_id": "foo2",
|
"snapshot_id": "second",
|
||||||
"description": "second",
|
"description": "second snapshot",
|
||||||
"latest_record_time_stamp": "2016-06-01T00:00:00Z",
|
"latest_record_time_stamp": "2016-06-01T00:00:00Z",
|
||||||
"latest_result_time_stamp": "2016-06-01T00:00:00Z"
|
"latest_result_time_stamp": "2016-06-01T00:00:00Z"
|
||||||
}
|
}
|
||||||
|
@ -144,23 +144,23 @@ setup:
|
||||||
- do:
|
- do:
|
||||||
xpack.ml.revert_model_snapshot:
|
xpack.ml.revert_model_snapshot:
|
||||||
job_id: "foo"
|
job_id: "foo"
|
||||||
snapshot_id: "foo1"
|
snapshot_id: "first"
|
||||||
|
|
||||||
- match: { acknowledged: true }
|
- match: { acknowledged: true }
|
||||||
- match: { model.job_id: "foo" }
|
- match: { model.job_id: "foo" }
|
||||||
- match: { model.timestamp: 1464825600000 }
|
- match: { model.timestamp: 1464825600000 }
|
||||||
- match: { model.snapshot_id: "foo1" }
|
- match: { model.snapshot_id: "first" }
|
||||||
- match: { model.snapshot_doc_count: 0 }
|
- match: { model.snapshot_doc_count: 0 }
|
||||||
|
|
||||||
- do:
|
- do:
|
||||||
xpack.ml.revert_model_snapshot:
|
xpack.ml.revert_model_snapshot:
|
||||||
job_id: "foo"
|
job_id: "foo"
|
||||||
snapshot_id: "foo2"
|
snapshot_id: "second"
|
||||||
|
|
||||||
- match: { acknowledged: true }
|
- match: { acknowledged: true }
|
||||||
- match: { model.job_id: "foo" }
|
- match: { model.job_id: "foo" }
|
||||||
- match: { model.timestamp: 1464739200000 }
|
- match: { model.timestamp: 1464739200000 }
|
||||||
- match: { model.snapshot_id: "foo2" }
|
- match: { model.snapshot_id: "second" }
|
||||||
- match: { model.snapshot_doc_count: 0 }
|
- match: { model.snapshot_doc_count: 0 }
|
||||||
|
|
||||||
---
|
---
|
||||||
|
@ -176,7 +176,7 @@ setup:
|
||||||
- do:
|
- do:
|
||||||
xpack.ml.revert_model_snapshot:
|
xpack.ml.revert_model_snapshot:
|
||||||
job_id: "foo"
|
job_id: "foo"
|
||||||
snapshot_id: "foo2"
|
snapshot_id: "second"
|
||||||
delete_intervening_results: true
|
delete_intervening_results: true
|
||||||
|
|
||||||
- do:
|
- do:
|
||||||
|
|
Loading…
Reference in New Issue