Skip to content

Commit

Permalink
flush job to ensure all results have been written (#31187)
Browse files Browse the repository at this point in the history
flush ml job to ensure all results have been written

fixes #31173
  • Loading branch information
Hendrik Muhs committed Jun 8, 2018
1 parent 0e697f4 commit 647b1a2
Showing 1 changed file with 13 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,9 @@ public void testOverflowToDisk() throws Exception {
throw e;
}

// flushing the job forces an index refresh, see https://github.com/elastic/elasticsearch/issues/31173
flushJob(job.getId(), false);

List<ForecastRequestStats> forecastStats = getForecastStats();
assertThat(forecastStats.size(), equalTo(1));
ForecastRequestStats forecastRequestStats = forecastStats.get(0);
Expand All @@ -261,6 +264,16 @@ public void testOverflowToDisk() throws Exception {
}

closeJob(job.getId());

forecastStats = getForecastStats();
assertThat(forecastStats.size(), equalTo(2));
for (ForecastRequestStats stats : forecastStats) {
forecasts = getForecasts(job.getId(), stats);

assertThat(forecastRequestStats.getRecordCount(), equalTo(8000L));
assertThat(forecasts.size(), equalTo(8000));
}

}

private void createDataWithLotsOfClientIps(TimeValue bucketSpan, Job.Builder job) throws IOException {
Expand Down

0 comments on commit 647b1a2

Please sign in to comment.