[TEST] Attempt to stabilize distributed ml tests.
Relates to elastic/x-pack-elasticsearch#653 Original commit: elastic/x-pack-elasticsearch@e4919ab2b4
This commit is contained in:
parent
e2f5715191
commit
212098fc7c
|
@ -85,7 +85,9 @@ public class BasicDistributedJobsIT extends BaseMlIntegTestCase {
|
||||||
PutJobAction.Request putJobRequest = new PutJobAction.Request(job.build());
|
PutJobAction.Request putJobRequest = new PutJobAction.Request(job.build());
|
||||||
PutJobAction.Response putJobResponse = client().execute(PutJobAction.INSTANCE, putJobRequest).get();
|
PutJobAction.Response putJobResponse = client().execute(PutJobAction.INSTANCE, putJobRequest).get();
|
||||||
assertTrue(putJobResponse.isAcknowledged());
|
assertTrue(putJobResponse.isAcknowledged());
|
||||||
DatafeedConfig config = createDatafeed("data_feed_id", job.getId(), Collections.singletonList("*"));
|
DatafeedConfig.Builder configBuilder = createDatafeedBuilder("data_feed_id", job.getId(), Collections.singletonList("*"));
|
||||||
|
configBuilder.setFrequency(120);
|
||||||
|
DatafeedConfig config = configBuilder.build();
|
||||||
PutDatafeedAction.Request putDatafeedRequest = new PutDatafeedAction.Request(config);
|
PutDatafeedAction.Request putDatafeedRequest = new PutDatafeedAction.Request(config);
|
||||||
PutDatafeedAction.Response putDatadeedResponse = client().execute(PutDatafeedAction.INSTANCE, putDatafeedRequest).get();
|
PutDatafeedAction.Response putDatadeedResponse = client().execute(PutDatafeedAction.INSTANCE, putDatafeedRequest).get();
|
||||||
assertTrue(putDatadeedResponse.isAcknowledged());
|
assertTrue(putDatadeedResponse.isAcknowledged());
|
||||||
|
|
|
@ -133,18 +133,23 @@ public abstract class BaseMlIntegTestCase extends SecurityIntegTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static DatafeedConfig createDatafeed(String datafeedId, String jobId, List<String> indexes) {
|
public static DatafeedConfig createDatafeed(String datafeedId, String jobId, List<String> indexes) {
|
||||||
|
return createDatafeedBuilder(datafeedId, jobId, indexes).build();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static DatafeedConfig.Builder createDatafeedBuilder(String datafeedId, String jobId, List<String> indexes) {
|
||||||
DatafeedConfig.Builder builder = new DatafeedConfig.Builder(datafeedId, jobId);
|
DatafeedConfig.Builder builder = new DatafeedConfig.Builder(datafeedId, jobId);
|
||||||
builder.setQueryDelay(1);
|
builder.setQueryDelay(1);
|
||||||
builder.setFrequency(2);
|
builder.setFrequency(2);
|
||||||
builder.setIndexes(indexes);
|
builder.setIndexes(indexes);
|
||||||
builder.setTypes(Collections.singletonList("type"));
|
builder.setTypes(Collections.singletonList("type"));
|
||||||
return builder.build();
|
return builder;
|
||||||
}
|
}
|
||||||
|
|
||||||
@After
|
@After
|
||||||
public void cleanupWorkaround() throws Exception {
|
public void cleanupWorkaround() throws Exception {
|
||||||
deleteAllDatafeeds(client());
|
deleteAllDatafeeds(client());
|
||||||
deleteAllJobs(client());
|
deleteAllJobs(client());
|
||||||
|
internalCluster().wipe(Collections.emptySet());
|
||||||
assertBusy(() -> {
|
assertBusy(() -> {
|
||||||
RecoveryResponse recoveryResponse = client().admin().indices().prepareRecoveries()
|
RecoveryResponse recoveryResponse = client().admin().indices().prepareRecoveries()
|
||||||
.setActiveOnly(true)
|
.setActiveOnly(true)
|
||||||
|
|
Loading…
Reference in New Issue