Fix Rest Tests Failing to Cleanup Rollup Jobs (#51246) (#51294)

* Fix Rest Tests Failing to Cleanup Rollup Jobs

If the rollup jobs index doesn't exist for some reason (like running against a 6.x cluster)
we should just assume the jobs have been cleaned up and move on.

Closes #50819
This commit is contained in:
Armin Braun 2020-01-22 11:38:20 +01:00 committed by GitHub
parent af76ae4ab9
commit d9ad66965c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 10 additions and 1 deletions

View File

@ -670,7 +670,16 @@ public abstract class ESRestTestCase extends ESTestCase {
}
private void wipeRollupJobs() throws IOException {
Response response = adminClient().performRequest(new Request("GET", "/_rollup/job/_all"));
final Response response;
try {
response = adminClient().performRequest(new Request("GET", "/_rollup/job/_all"));
} catch (ResponseException e) {
// If we don't see the rollup endpoint (possibly because of running against an older ES version) we just bail
if (e.getResponse().getStatusLine().getStatusCode() == RestStatus.NOT_FOUND.getStatus()) {
return;
}
throw e;
}
Map<String, Object> jobs = entityAsMap(response);
@SuppressWarnings("unchecked")
List<Map<String, Object>> jobConfigs =