Skip to content

Commit

Permalink
[ML] Increase wait for forecasts in FIPS JVM (#70023)
Browse files Browse the repository at this point in the history
Forecast tests have been seen to fail in the FIPS JVM
because they take far longer than without FIPS.

This change waits up to 5 minutes for forecasts in FIPS
mode (compared to the usual 1 minute).

Fixes #63793
  • Loading branch information
droberts195 committed Mar 8, 2021
1 parent a875d55 commit d36ece9
Showing 1 changed file with 12 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,8 @@
*/
abstract class MlNativeAutodetectIntegTestCase extends MlNativeIntegTestCase {

private List<Job.Builder> jobs = new ArrayList<>();
private List<DatafeedConfig> datafeeds = new ArrayList<>();
private final List<Job.Builder> jobs = new ArrayList<>();
private final List<DatafeedConfig> datafeeds = new ArrayList<>();

@Override
protected void cleanUpResources() {
Expand Down Expand Up @@ -290,17 +290,25 @@ protected String forecast(String jobId, TimeValue duration, TimeValue expiresIn,
}

protected void waitForecastToFinish(String jobId, String forecastId) throws Exception {
waitForecastStatus(jobId, forecastId, ForecastRequestStats.ForecastRequestStatus.FINISHED);
// Forecasts can take an eternity to complete in the FIPS JVM
waitForecastStatus(inFipsJvm() ? 300 : 60, jobId, forecastId, ForecastRequestStats.ForecastRequestStatus.FINISHED);
}

protected void waitForecastStatus(String jobId,
String forecastId,
ForecastRequestStats.ForecastRequestStatus... status) throws Exception {
waitForecastStatus(30, jobId, forecastId, status);
}

protected void waitForecastStatus(int maxWaitTimeSeconds,
String jobId,
String forecastId,
ForecastRequestStats.ForecastRequestStatus... status) throws Exception {
assertBusy(() -> {
ForecastRequestStats forecastRequestStats = getForecastStats(jobId, forecastId);
assertThat(forecastRequestStats, is(notNullValue()));
assertThat(forecastRequestStats.getStatus(), in(status));
}, 60, TimeUnit.SECONDS);
}, maxWaitTimeSeconds, TimeUnit.SECONDS);
}

protected void assertThatNumberOfAnnotationsIsEqualTo(int expectedNumberOfAnnotations) throws IOException {
Expand Down

0 comments on commit d36ece9

Please sign in to comment.