[ML][TEST] Add delays between forecasts to ensure id uniqueness
relates elastic/x-pack-elasticsearch#3090
Original commit: elastic/x-pack-elasticsearch@b56d970cc6c0a7dc6f142e7fb9db37f2b906460b
@@ -124,9 +124,15 @@ public class DeleteExpiredDataIT extends MlNativeAutodetectIntegTestCase {
// Now let's create some forecasts
openJob(job.getId());
long forecastShortExpiryId = forecast(job.getId(), TimeValue.timeValueHours(3), TimeValue.timeValueSeconds(1));
+ // We need to wait so that forecasts get different IDs
+ awaitBusy(() -> false, 5, TimeUnit.MILLISECONDS);
shortExpiryForecastIds.add(forecastShortExpiryId);
+
long forecastDefaultExpiryId = forecast(job.getId(), TimeValue.timeValueHours(3), null);
+ awaitBusy(() -> false, 5, TimeUnit.MILLISECONDS);
+
long forecastNoExpiryId = forecast(job.getId(), TimeValue.timeValueHours(3), TimeValue.ZERO);
+
waitForecastToFinish(job.getId(), forecastShortExpiryId);
waitForecastToFinish(job.getId(), forecastDefaultExpiryId);
waitForecastToFinish(job.getId(), forecastNoExpiryId);
