-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbuckets_stack.yml
90 lines (86 loc) · 2.48 KB
/
buckets_stack.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
---
requires:
serverless: false
stack: true
---
setup:
- do:
ml.put_job:
job_id: jobs-get-result-buckets
body: >
{
"analysis_config" : {
"detectors" :[{"function":"metric","field_name":"responsetime","by_field_name":"airline"}]
},
"data_description" : {
"format":"xcontent",
"time_field":"time"
}
}
- do:
index:
index: .ml-anomalies-jobs-get-result-buckets
id: "jobs-get-result-buckets_1464739200000_1"
body:
{
"job_id": "jobs-get-result-buckets",
"result_type": "bucket",
"timestamp": "2016-06-01T00:00:00Z",
"anomaly_score": 90.0,
"bucket_span":1
}
- do:
index:
index: .ml-anomalies-jobs-get-result-buckets
id: "jobs-get-result-buckets_1470009600000_2"
body:
{
"job_id": "jobs-get-result-buckets",
"result_type": "bucket",
"timestamp": "2016-08-01T00:00:00Z",
"anomaly_score": 60.0,
"bucket_span":1,
"is_interim": true
}
- do:
index:
index: .ml-anomalies-jobs-get-result-buckets
id: "jobs-get-result-buckets_1470096000000_3"
body:
{
"job_id": "jobs-get-result-buckets",
"result_type": "bucket",
"timestamp": "2016-08-02T00:00:00Z",
"anomaly_score": 60.0,
"bucket_span":1,
}
- do:
indices.refresh:
index: .ml-anomalies-jobs-get-result-buckets
---
teardown:
- do:
ml.delete_job:
job_id: jobs-get-result-buckets
---
"Test buckets":
- do:
ml.get_overall_buckets:
job_id: "jobs-get-result-*"
- gte: { count: 1 }
- do:
ml.get_buckets:
job_id: "jobs-get-result-buckets"
- match: { count: 3 }
- match: { buckets.0.timestamp: 1464739200000 }
- match: { buckets.0.job_id: jobs-get-result-buckets}
- match: { buckets.0.result_type: bucket}
- match: { buckets.1.timestamp: 1470009600000 }
- match: { buckets.1.job_id: jobs-get-result-buckets}
- match: { buckets.1.result_type: bucket}
- match: { buckets.2.timestamp: 1470096000000 }
- match: { buckets.2.job_id: jobs-get-result-buckets}
- match: { buckets.2.result_type: bucket}
- is_false: buckets.0.partition_scores
- is_false: buckets.1.partition_scores
- is_false: buckets.2.partition_scores