[TEST] Change default close timeout for close job requests in tests.
Original commit: elastic/x-pack-elasticsearch@240bb0561c
This commit is contained in:
parent
c49a17e7ca
commit
0e44683de6
|
@ -8,6 +8,7 @@ package org.elasticsearch.xpack.ml.integration;
|
||||||
import org.elasticsearch.ElasticsearchStatusException;
|
import org.elasticsearch.ElasticsearchStatusException;
|
||||||
import org.elasticsearch.cluster.ClusterState;
|
import org.elasticsearch.cluster.ClusterState;
|
||||||
import org.elasticsearch.common.settings.Settings;
|
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.CloseJobAction;
|
||||||
import org.elasticsearch.xpack.ml.action.GetJobsStatsAction;
|
import org.elasticsearch.xpack.ml.action.GetJobsStatsAction;
|
||||||
import org.elasticsearch.xpack.ml.action.OpenJobAction;
|
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:
|
// close the first job and check if the latest job gets opened:
|
||||||
CloseJobAction.Request closeRequest = new CloseJobAction.Request("1");
|
CloseJobAction.Request closeRequest = new CloseJobAction.Request("1");
|
||||||
|
closeRequest.setTimeout(TimeValue.timeValueSeconds(30L));
|
||||||
CloseJobAction.Response closeResponse = client().execute(CloseJobAction.INSTANCE, closeRequest).actionGet();
|
CloseJobAction.Response closeResponse = client().execute(CloseJobAction.INSTANCE, closeRequest).actionGet();
|
||||||
assertTrue(closeResponse.isClosed());
|
assertTrue(closeResponse.isClosed());
|
||||||
client().execute(OpenJobAction.INSTANCE, openJobRequest).get();
|
client().execute(OpenJobAction.INSTANCE, openJobRequest).get();
|
||||||
|
|
|
@ -9,6 +9,7 @@ import org.elasticsearch.ExceptionsHelper;
|
||||||
import org.elasticsearch.client.Client;
|
import org.elasticsearch.client.Client;
|
||||||
import org.elasticsearch.cluster.metadata.MetaData;
|
import org.elasticsearch.cluster.metadata.MetaData;
|
||||||
import org.elasticsearch.common.settings.Settings;
|
import org.elasticsearch.common.settings.Settings;
|
||||||
|
import org.elasticsearch.common.unit.TimeValue;
|
||||||
import org.elasticsearch.rest.RestStatus;
|
import org.elasticsearch.rest.RestStatus;
|
||||||
import org.elasticsearch.test.ESIntegTestCase;
|
import org.elasticsearch.test.ESIntegTestCase;
|
||||||
import org.elasticsearch.test.SecurityIntegTestCase;
|
import org.elasticsearch.test.SecurityIntegTestCase;
|
||||||
|
@ -158,8 +159,10 @@ public abstract class BaseMlIntegTestCase extends SecurityIntegTestCase {
|
||||||
for (Map.Entry<String, Job> entry : mlMetadata.getJobs().entrySet()) {
|
for (Map.Entry<String, Job> entry : mlMetadata.getJobs().entrySet()) {
|
||||||
String jobId = entry.getKey();
|
String jobId = entry.getKey();
|
||||||
try {
|
try {
|
||||||
|
CloseJobAction.Request closeRequest = new CloseJobAction.Request(jobId);
|
||||||
|
closeRequest.setTimeout(TimeValue.timeValueSeconds(30L));
|
||||||
CloseJobAction.Response response =
|
CloseJobAction.Response response =
|
||||||
client.execute(CloseJobAction.INSTANCE, new CloseJobAction.Request(jobId)).get();
|
client.execute(CloseJobAction.INSTANCE, closeRequest).get();
|
||||||
assertTrue(response.isClosed());
|
assertTrue(response.isClosed());
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
// CONFLICT is ok, as it means the job has been closed already, which isn't an issue at all.
|
// CONFLICT is ok, as it means the job has been closed already, which isn't an issue at all.
|
||||||
|
|
Loading…
Reference in New Issue