[ML][TEST] Fix BasicRenormalizationIT after adding multibucket feature

As the multibucket feature was merged in, this test hit a side effect
which means buckets trailing an anomaly could become anomalous.
This commit fixes the problem by filtering low score records when
we request them.
This commit is contained in:
Dimitris Athanasiou 2018-08-17 17:52:29 +01:00
parent c5de9ec79d
commit 46c35db1df
1 changed files with 6 additions and 1 deletions

View File

@ -7,6 +7,7 @@ package org.elasticsearch.xpack.ml.integration;
import org.elasticsearch.common.unit.TimeValue; import org.elasticsearch.common.unit.TimeValue;
import org.elasticsearch.xpack.core.ml.action.GetJobsStatsAction; import org.elasticsearch.xpack.core.ml.action.GetJobsStatsAction;
import org.elasticsearch.xpack.core.ml.action.GetRecordsAction;
import org.elasticsearch.xpack.core.ml.job.config.AnalysisConfig; import org.elasticsearch.xpack.core.ml.job.config.AnalysisConfig;
import org.elasticsearch.xpack.core.ml.job.config.DataDescription; import org.elasticsearch.xpack.core.ml.job.config.DataDescription;
import org.elasticsearch.xpack.core.ml.job.config.Detector; import org.elasticsearch.xpack.core.ml.job.config.Detector;
@ -36,7 +37,11 @@ public class BasicRenormalizationIT extends MlNativeAutodetectIntegTestCase {
String jobId = "basic-renormalization-it-test-default-renormalization-job"; String jobId = "basic-renormalization-it-test-default-renormalization-job";
createAndRunJob(jobId, null); createAndRunJob(jobId, null);
List<AnomalyRecord> records = getRecords(jobId); GetRecordsAction.Request getRecordsRequest = new GetRecordsAction.Request(jobId);
// Setting the record score to 10.0, to avoid the low score records due to multibucket trailing effect
getRecordsRequest.setRecordScore(10.0);
List<AnomalyRecord> records = getRecords(getRecordsRequest);
assertThat(records.size(), equalTo(2)); assertThat(records.size(), equalTo(2));
AnomalyRecord laterRecord = records.get(0); AnomalyRecord laterRecord = records.get(0);
assertThat(laterRecord.getActual().get(0), equalTo(100.0)); assertThat(laterRecord.getActual().get(0), equalTo(100.0));