diff --git a/plugin/src/test/java/org/elasticsearch/xpack/ml/integration/TooManyJobsIT.java b/plugin/src/test/java/org/elasticsearch/xpack/ml/integration/TooManyJobsIT.java index 073d1ee0904..b3685a9ecfc 100644 --- a/plugin/src/test/java/org/elasticsearch/xpack/ml/integration/TooManyJobsIT.java +++ b/plugin/src/test/java/org/elasticsearch/xpack/ml/integration/TooManyJobsIT.java @@ -8,6 +8,7 @@ package org.elasticsearch.xpack.ml.integration; import org.elasticsearch.ElasticsearchStatusException; import org.elasticsearch.cluster.ClusterState; import org.elasticsearch.common.settings.Settings; +import org.elasticsearch.common.unit.TimeValue; import org.elasticsearch.xpack.ml.action.CloseJobAction; import org.elasticsearch.xpack.ml.action.GetJobsStatsAction; import org.elasticsearch.xpack.ml.action.OpenJobAction; @@ -94,6 +95,7 @@ public class TooManyJobsIT extends BaseMlIntegTestCase { // close the first job and check if the latest job gets opened: CloseJobAction.Request closeRequest = new CloseJobAction.Request("1"); + closeRequest.setTimeout(TimeValue.timeValueSeconds(30L)); CloseJobAction.Response closeResponse = client().execute(CloseJobAction.INSTANCE, closeRequest).actionGet(); assertTrue(closeResponse.isClosed()); client().execute(OpenJobAction.INSTANCE, openJobRequest).get(); diff --git a/plugin/src/test/java/org/elasticsearch/xpack/ml/support/BaseMlIntegTestCase.java b/plugin/src/test/java/org/elasticsearch/xpack/ml/support/BaseMlIntegTestCase.java index 8f4574853d9..c934fabcceb 100644 --- a/plugin/src/test/java/org/elasticsearch/xpack/ml/support/BaseMlIntegTestCase.java +++ b/plugin/src/test/java/org/elasticsearch/xpack/ml/support/BaseMlIntegTestCase.java @@ -9,6 +9,7 @@ import org.elasticsearch.ExceptionsHelper; import org.elasticsearch.client.Client; import org.elasticsearch.cluster.metadata.MetaData; import org.elasticsearch.common.settings.Settings; +import org.elasticsearch.common.unit.TimeValue; import org.elasticsearch.rest.RestStatus; import org.elasticsearch.test.ESIntegTestCase; import org.elasticsearch.test.SecurityIntegTestCase; @@ -158,8 +159,10 @@ public abstract class BaseMlIntegTestCase extends SecurityIntegTestCase { for (Map.Entry entry : mlMetadata.getJobs().entrySet()) { String jobId = entry.getKey(); try { + CloseJobAction.Request closeRequest = new CloseJobAction.Request(jobId); + closeRequest.setTimeout(TimeValue.timeValueSeconds(30L)); CloseJobAction.Response response = - client.execute(CloseJobAction.INSTANCE, new CloseJobAction.Request(jobId)).get(); + client.execute(CloseJobAction.INSTANCE, closeRequest).get(); assertTrue(response.isClosed()); } catch (Exception e) { // CONFLICT is ok, as it means the job has been closed already, which isn't an issue at all.