[ML] Wait for job to close in test (elastic/x-pack-elasticsearch#1825)

Original commit: elastic/x-pack-elasticsearch@3dbeed58f3
This commit is contained in:
David Kyle 2017-06-22 17:12:18 +01:00
parent fc2f68609d
commit 12eec0e911
1 changed files with 9 additions and 0 deletions

View File

@ -406,6 +406,15 @@ public class MachineLearningLicensingTests extends BaseMlIntegTestCase {
} else {
listener.actionGet();
}
if (invalidLicense) {
// the close due to invalid license happens async, so check if the job turns into closed state:
assertBusy(() -> {
GetJobsStatsAction.Response response =
new MachineLearningClient(client).getJobsStats(new GetJobsStatsAction.Request(jobId)).actionGet();
assertEquals(JobState.CLOSED, response.getResponse().results().get(0).getState());
});
}
}
}