Skip to content

Commit a9e829a

Browse files
authored
Create a separate job solely for the purpose of verifying its timing stats in mixed and upgraded cluster. (#43315)
1 parent 9a4ffa3 commit a9e829a

File tree

3 files changed

+74
-6
lines changed

3 files changed

+74
-6
lines changed

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,10 @@
3939
"Test get old cluster job's timing stats":
4040
- do:
4141
ml.get_job_stats:
42-
job_id: old-cluster-job
43-
- match: { jobs.0.job_id: old-cluster-job }
42+
job_id: old-cluster-job-with-ts
43+
- match: { jobs.0.job_id: old-cluster-job-with-ts }
4444
- match: { jobs.0.state: "closed" }
45-
- match: { jobs.0.timing_stats.job_id: old-cluster-job }
45+
- match: { jobs.0.timing_stats.job_id: old-cluster-job-with-ts }
4646
- match: { jobs.0.timing_stats.bucket_count: 1 }
4747
- gte: { jobs.0.timing_stats.minimum_bucket_processing_time_ms: 0.0 }
4848
- gte: { jobs.0.timing_stats.maximum_bucket_processing_time_ms: 0.0 }

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: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -113,16 +113,26 @@ setup:
113113
"Test get old cluster job's timing stats":
114114
- do:
115115
ml.get_job_stats:
116-
job_id: old-cluster-job
117-
- match: { jobs.0.job_id: old-cluster-job }
116+
job_id: old-cluster-job-with-ts
117+
- match: { jobs.0.job_id: old-cluster-job-with-ts }
118118
- match: { jobs.0.state: "closed" }
119-
- match: { jobs.0.timing_stats.job_id: old-cluster-job }
119+
- match: { jobs.0.timing_stats.job_id: old-cluster-job-with-ts }
120120
- match: { jobs.0.timing_stats.bucket_count: 1 }
121121
- gte: { jobs.0.timing_stats.minimum_bucket_processing_time_ms: 0.0 }
122122
- gte: { jobs.0.timing_stats.maximum_bucket_processing_time_ms: 0.0 }
123123
- gte: { jobs.0.timing_stats.average_bucket_processing_time_ms: 0.0 }
124124
- gte: { jobs.0.timing_stats.exponential_average_bucket_processing_time_ms: 0.0 }
125125

126+
- do:
127+
ml.delete_job:
128+
job_id: old-cluster-job-with-ts
129+
- match: { acknowledged: true }
130+
131+
- do:
132+
catch: missing
133+
ml.get_jobs:
134+
job_id: old-cluster-job-with-ts
135+
126136
---
127137
"Test job with pre 6.4 rules":
128138

0 commit comments

Comments
 (0)