change test to wait allocation has been added (which is added in the background)

Original commit: elastic/x-pack-elasticsearch@6b60d37fb5
This commit is contained in:
Martijn van Groningen 2016-11-28 18:13:31 +01:00
parent 2cbc415f38
commit b526d7920d
1 changed files with 13 additions and 0 deletions

View File

@ -88,6 +88,19 @@ public class TooManyJobsIT extends ESIntegTestCase {
clearPrelertMetadata();
putJobResponse = client().execute(PutJobAction.INSTANCE, putJobRequest).get();
assertTrue(putJobResponse.isAcknowledged());
assertBusy(() -> {
try {
GetJobsAction.Request getJobRequest = new GetJobsAction.Request();
getJobRequest.setJobId(job.getId());
getJobRequest.status(true);
GetJobsAction.Response response = client().execute(GetJobsAction.INSTANCE, getJobRequest).get();
GetJobsAction.Response.JobInfo jobInfo = response.getResponse().results().get(0);
assertNotNull(jobInfo);
assertEquals(JobStatus.CLOSED, jobInfo.getStatus());
} catch (Exception e1) {
fail("failure " + e1.getMessage());
}
});
PostDataAction.Response postDataResponse = client().execute(PostDataAction.INSTANCE, postDataRequest).get();
assertEquals(1, postDataResponse.getDataCounts().getInputRecordCount());
return;