[TEST] Use cluster state api to check whether job state is closed.
Original commit: elastic/x-pack-elasticsearch@27c9aa0c417bfa0e299f51c3c9591c660b36c137
@@ -99,9 +99,9 @@ public class TooManyJobsIT extends BaseMlIntegTestCase {
client().execute(OpenJobAction.INSTANCE, openJobRequest).actionGet();
assertBusy(() -> {
for (Client client : clients()) {
- GetJobsStatsAction.Response statsResponse =
- client.execute(GetJobsStatsAction.INSTANCE, new GetJobsStatsAction.Request(job.getId())).actionGet();
- assertEquals(statsResponse.getResponse().results().get(0).getState(), JobState.OPENED);
+ PersistentTasksCustomMetaData tasks = client.admin().cluster().prepareState().get().getState()
+ .getMetaData().custom(PersistentTasksCustomMetaData.TYPE);
+ assertEquals(MlMetadata.getJobState(job.getId(), tasks), JobState.OPENED);
}
});
return;
