Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions muted-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -94,9 +94,6 @@ tests:
- class: org.elasticsearch.smoketest.MlWithSecurityIT
method: test {yaml=ml/sparse_vector_search/Test sparse_vector search with query vector and pruning config}
issue: https://github.com/elastic/elasticsearch/issues/119548
- class: org.elasticsearch.xpack.ml.integration.ForecastIT
method: testOverflowToDisk
issue: https://github.com/elastic/elasticsearch/issues/117740
- class: org.elasticsearch.multi_cluster.MultiClusterYamlTestSuiteIT
issue: https://github.com/elastic/elasticsearch/issues/119983
- class: org.elasticsearch.xpack.test.rest.XPackRestIT
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,19 @@ protected String forecast(String jobId, TimeValue duration, TimeValue expiresIn,

protected void waitForecastToFinish(String jobId, String forecastId) throws Exception {
// Forecasts can take an eternity to complete in the FIPS JVM
waitForecastStatus(inFipsJvm() ? 300 : 90, jobId, forecastId, ForecastRequestStats.ForecastRequestStatus.FINISHED);
int timeoutSeconds = inFipsJvm() ? 300 : 90;
// First wait for the forecast document to exist and be in a non-terminal state
// This handles the race condition where the document may be SCHEDULED or STARTED initially
waitForecastStatus(
timeoutSeconds,
jobId,
forecastId,
ForecastRequestStats.ForecastRequestStatus.SCHEDULED,
ForecastRequestStats.ForecastRequestStatus.STARTED,
ForecastRequestStats.ForecastRequestStatus.FINISHED
);
Comment on lines +249 to +259
Copy link

Copilot AI Oct 31, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Corrected spelling of 'flacky' to 'flaky' in the PR title.

Copilot uses AI. Check for mistakes.
// Then wait specifically for FINISHED status
waitForecastStatus(timeoutSeconds, jobId, forecastId, ForecastRequestStats.ForecastRequestStatus.FINISHED);
}

protected void waitForecastStatus(String jobId, String forecastId, ForecastRequestStats.ForecastRequestStatus... status)
Expand All @@ -261,6 +273,10 @@ protected void waitForecastStatus(
ForecastRequestStats.ForecastRequestStatus... status
) throws Exception {
assertBusy(() -> {
// Refresh the index to ensure recently indexed forecast stats documents are visible
indicesAdmin().prepareRefresh(AnomalyDetectorsIndex.jobResultsAliasedName(jobId))
.setIndicesOptions(IndicesOptions.LENIENT_EXPAND_OPEN_HIDDEN)
.get();
ForecastRequestStats forecastRequestStats = getForecastStats(jobId, forecastId);
assertThat(forecastRequestStats, is(notNullValue()));
assertThat(forecastRequestStats.getStatus(), in(status));
Expand Down