From b526d7920d3574ec830b25639f0bd345c103b8e1 Mon Sep 17 00:00:00 2001 From: Martijn van Groningen Date: Mon, 28 Nov 2016 18:13:31 +0100 Subject: [PATCH] change test to wait allocation has been added (which is added in the background) Original commit: elastic/x-pack-elasticsearch@6b60d37fb58bce0bc376b50e5586ed2132a066b4 --- .../xpack/prelert/integration/TooManyJobsIT.java | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/elasticsearch/src/test/java/org/elasticsearch/xpack/prelert/integration/TooManyJobsIT.java b/elasticsearch/src/test/java/org/elasticsearch/xpack/prelert/integration/TooManyJobsIT.java index 5dccb72bddc..f72d6e0fb6a 100644 --- a/elasticsearch/src/test/java/org/elasticsearch/xpack/prelert/integration/TooManyJobsIT.java +++ b/elasticsearch/src/test/java/org/elasticsearch/xpack/prelert/integration/TooManyJobsIT.java @@ -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;