Skip to content

Commit 459d57f

Browse files
authored
[7.x] [ML] BWC tests for job_stats.timing_stats field (#43267) (#43293)
1 parent 818a709 commit 459d57f

File tree

3 files changed

+91
-0
lines changed

3 files changed

+91
-0
lines changed

x-pack/qa/rolling-upgrade/src/test/resources/rest-api-spec/test/mixed_cluster/30_ml_jobs_crud.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,19 @@
3535
job_id: old-cluster-job
3636
- match: { count: 1 }
3737

38+
---
39+
"Test get old cluster job's timing stats":
40+
- skip:
41+
version: " - 7.2.99"
42+
reason: timing_stats was introduced in 7.3.0
43+
- do:
44+
ml.get_job_stats:
45+
job_id: old-cluster-job-with-ts
46+
- match: { jobs.0.job_id: old-cluster-job-with-ts }
47+
- match: { jobs.0.state: "closed" }
48+
- match: { jobs.0.timing_stats.job_id: old-cluster-job-with-ts }
49+
- gte: { jobs.0.timing_stats.bucket_count: 0 }
50+
3851
---
3952
"Test get old cluster categorization job":
4053
- do:

x-pack/qa/rolling-upgrade/src/test/resources/rest-api-spec/test/old_cluster/30_ml_jobs_crud.yml

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,64 @@
169169
index: [".ml-state", ".ml-anomalies-shared"]
170170
wait_for_status: green
171171

172+
---
173+
"Put job with timing stats checking on the old cluster and post some data":
174+
175+
- do:
176+
ml.put_job:
177+
job_id: old-cluster-job-with-ts
178+
body: >
179+
{
180+
"description":"Cluster upgrade with timing stats checking",
181+
"analysis_config" : {
182+
"bucket_span": "60s",
183+
"detectors" :[{"function":"metric","field_name":"responsetime","by_field_name":"airline"}]
184+
},
185+
"analysis_limits" : {
186+
"model_memory_limit": "50mb"
187+
},
188+
"data_description" : {
189+
"format":"xcontent",
190+
"time_field":"time",
191+
"time_format":"epoch"
192+
}
193+
}
194+
- match: { job_id: old-cluster-job-with-ts }
195+
196+
- do:
197+
ml.open_job:
198+
job_id: old-cluster-job-with-ts
199+
200+
- do:
201+
ml.post_data:
202+
job_id: old-cluster-job-with-ts
203+
body:
204+
- airline: AAL
205+
responsetime: 132.2046
206+
sourcetype: post-data-job
207+
time: 1403481600
208+
- airline: JZA
209+
responsetime: 990.4628
210+
sourcetype: post-data-job
211+
time: 1403481700
212+
- match: { processed_record_count: 2 }
213+
214+
- do:
215+
ml.close_job:
216+
job_id: old-cluster-job-with-ts
217+
218+
- do:
219+
ml.get_buckets:
220+
job_id: old-cluster-job-with-ts
221+
- match: { count: 1 }
222+
223+
# Wait for indices to be fully allocated before
224+
# killing the node
225+
- do:
226+
cluster.health:
227+
index: [".ml-state", ".ml-anomalies-shared"]
228+
wait_for_status: green
229+
172230
---
173231
"Put job with empty strings in the configuration":
174232
- do:

x-pack/qa/rolling-upgrade/src/test/resources/rest-api-spec/test/upgraded_cluster/30_ml_jobs_crud.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,26 @@ setup:
109109
name: ".ml-state-write"
110110
- is_true: ''
111111

112+
---
113+
"Test get old cluster job's timing stats":
114+
- do:
115+
ml.get_job_stats:
116+
job_id: old-cluster-job-with-ts
117+
- match: { jobs.0.job_id: old-cluster-job-with-ts }
118+
- match: { jobs.0.state: "closed" }
119+
- match: { jobs.0.timing_stats.job_id: old-cluster-job-with-ts }
120+
- gte: { jobs.0.timing_stats.bucket_count: 0 }
121+
122+
- do:
123+
ml.delete_job:
124+
job_id: old-cluster-job-with-ts
125+
- match: { acknowledged: true }
126+
127+
- do:
128+
catch: missing
129+
ml.get_jobs:
130+
job_id: old-cluster-job-with-ts
131+
112132
---
113133
"Test job with pre 6.4 rules":
114134

0 commit comments

Comments
 (0)