[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:
Martijn van Groningen 2017-02-27 11:10:12 +01:00
parent e2f5715191
commit 212098fc7c
2 changed files with 9 additions and 2 deletions

View File

@ -85,7 +85,9 @@ public class BasicDistributedJobsIT extends BaseMlIntegTestCase {
PutJobAction.Request putJobRequest = new PutJobAction.Request(job.build());
PutJobAction.Response putJobResponse = client().execute(PutJobAction.INSTANCE, putJobRequest).get();
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.Response putDatadeedResponse = client().execute(PutDatafeedAction.INSTANCE, putDatafeedRequest).get();
assertTrue(putDatadeedResponse.isAcknowledged());

View File

@ -133,18 +133,23 @@ public abstract class BaseMlIntegTestCase extends SecurityIntegTestCase {
}
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);
builder.setQueryDelay(1);
builder.setFrequency(2);
builder.setIndexes(indexes);
builder.setTypes(Collections.singletonList("type"));
return builder.build();
return builder;
}
@After
public void cleanupWorkaround() throws Exception {
deleteAllDatafeeds(client());
deleteAllJobs(client());
internalCluster().wipe(Collections.emptySet());
assertBusy(() -> {
RecoveryResponse recoveryResponse = client().admin().indices().prepareRecoveries()
.setActiveOnly(true)