Skip to content

Commit 647b1a2

Browse files
author
Hendrik Muhs
committed
flush job to ensure all results have been written (#31187)
flush ml job to ensure all results have been written fixes #31173
1 parent 0e697f4 commit 647b1a2

File tree

1 file changed

+13
-0
lines changed
  • x-pack/qa/ml-native-tests/src/test/java/org/elasticsearch/xpack/ml/integration

1 file changed

+13
-0
lines changed

x-pack/qa/ml-native-tests/src/test/java/org/elasticsearch/xpack/ml/integration/ForecastIT.java

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -239,6 +239,9 @@ public void testOverflowToDisk() throws Exception {
239239
throw e;
240240
}
241241

242+
// flushing the job forces an index refresh, see https://github.com/elastic/elasticsearch/issues/31173
243+
flushJob(job.getId(), false);
244+
242245
List<ForecastRequestStats> forecastStats = getForecastStats();
243246
assertThat(forecastStats.size(), equalTo(1));
244247
ForecastRequestStats forecastRequestStats = forecastStats.get(0);
@@ -261,6 +264,16 @@ public void testOverflowToDisk() throws Exception {
261264
}
262265

263266
closeJob(job.getId());
267+
268+
forecastStats = getForecastStats();
269+
assertThat(forecastStats.size(), equalTo(2));
270+
for (ForecastRequestStats stats : forecastStats) {
271+
forecasts = getForecasts(job.getId(), stats);
272+
273+
assertThat(forecastRequestStats.getRecordCount(), equalTo(8000L));
274+
assertThat(forecasts.size(), equalTo(8000));
275+
}
276+
264277
}
265278

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

0 commit comments

Comments
 (0)