mirror of
https://github.com/honeymoose/OpenSearch.git
synced 2025-02-17 18:35:25 +00:00
[TEST] Wait for job to close from DatafeedJobsIT.testLookbackOnly
relates elastic/x-pack-elasticsearch#1228 Original commit: elastic/x-pack-elasticsearch@77055bd128
This commit is contained in:
parent
16177d46d3
commit
7e62eb6255
@ -165,6 +165,8 @@ public class DatafeedJobsIT extends SecurityIntegTestCase {
|
|||||||
GetDatafeedsStatsAction.Response response = client().execute(GetDatafeedsStatsAction.INSTANCE, request).actionGet();
|
GetDatafeedsStatsAction.Response response = client().execute(GetDatafeedsStatsAction.INSTANCE, request).actionGet();
|
||||||
assertThat(response.getResponse().results().get(0).getDatafeedState(), equalTo(DatafeedState.STOPPED));
|
assertThat(response.getResponse().results().get(0).getDatafeedState(), equalTo(DatafeedState.STOPPED));
|
||||||
}, 60, TimeUnit.SECONDS);
|
}, 60, TimeUnit.SECONDS);
|
||||||
|
|
||||||
|
waitUntilJobIsClosed(job.getId());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testRealtime() throws Exception {
|
public void testRealtime() throws Exception {
|
||||||
@ -228,4 +230,15 @@ public class DatafeedJobsIT extends SecurityIntegTestCase {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void waitUntilJobIsClosed(String jobId) throws Exception {
|
||||||
|
assertBusy(() -> {
|
||||||
|
try {
|
||||||
|
GetJobsStatsAction.Request request = new GetJobsStatsAction.Request(jobId);
|
||||||
|
GetJobsStatsAction.Response response = client().execute(GetJobsStatsAction.INSTANCE, request).get();
|
||||||
|
assertThat(response.getResponse().results().get(0).getState(), equalTo(JobState.CLOSED));
|
||||||
|
} catch (Exception e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
}, 30, TimeUnit.SECONDS);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user