Flushing a closed job should not return a 200 (elastic/elasticsearch#625)
Original commit: elastic/x-pack-elasticsearch@419389e1af
This commit is contained in:
parent
c58d1d43d6
commit
7a7ec570ae
|
@ -137,8 +137,9 @@ public class AutodetectProcessManager extends AbstractComponent implements DataP
|
|||
logger.debug("Flushing job {}", jobId);
|
||||
AutodetectCommunicator communicator = autoDetectCommunicatorByJob.get(jobId);
|
||||
if (communicator == null) {
|
||||
logger.debug("Cannot flush: no active autodetect process for job {}", jobId);
|
||||
return;
|
||||
String message = String.format(Locale.ROOT, "[%s] Cannot flush: no active autodetect process for job", jobId);
|
||||
logger.debug(message);
|
||||
throw new IllegalArgumentException(message);
|
||||
}
|
||||
try {
|
||||
communicator.flushJob(params);
|
||||
|
|
|
@ -16,6 +16,20 @@ setup:
|
|||
}
|
||||
}
|
||||
|
||||
- do:
|
||||
xpack.prelert.put_job:
|
||||
body: >
|
||||
{
|
||||
"job_id":"closed_job",
|
||||
"description":"A closed job",
|
||||
"analysis_config" : {
|
||||
"detectors" :[{"function":"metric","field_name":"responsetime","by_field_name":"airline"}]
|
||||
},
|
||||
"data_description" : {
|
||||
"format":"JSON"
|
||||
}
|
||||
}
|
||||
|
||||
- do:
|
||||
xpack.prelert.open_job:
|
||||
job_id: farequote
|
||||
|
@ -149,3 +163,21 @@ setup:
|
|||
catch: missing
|
||||
xpack.prelert.close_job:
|
||||
job_id: not_a_job
|
||||
|
||||
---
|
||||
"Test flushing, posting and closing a closed job":
|
||||
- do:
|
||||
catch: /illegal_argument_exception/
|
||||
xpack.prelert.flush_job:
|
||||
job_id: closed_job
|
||||
|
||||
- do:
|
||||
catch: /illegal_argument_exception/
|
||||
xpack.prelert.close_job:
|
||||
job_id: closed_job
|
||||
|
||||
- do:
|
||||
catch: /illegal_argument_exception/
|
||||
xpack.prelert.job_data:
|
||||
job_id: closed_job
|
||||
body: {}
|
||||
|
|
Loading…
Reference in New Issue