Skip to content

Commit d9ad669

Browse files
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
1 parent af76ae4 commit d9ad669

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

test/framework/src/main/java/org/elasticsearch/test/rest/ESRestTestCase.java

+10-1
Original file line numberDiff line numberDiff line change
@@ -670,7 +670,16 @@ private void wipeClusterSettings() throws IOException {
670670
}
671671

672672
private void wipeRollupJobs() throws IOException {
673-
Response response = adminClient().performRequest(new Request("GET", "/_rollup/job/_all"));
673+
final Response response;
674+
try {
675+
response = adminClient().performRequest(new Request("GET", "/_rollup/job/_all"));
676+
} catch (ResponseException e) {
677+
// If we don't see the rollup endpoint (possibly because of running against an older ES version) we just bail
678+
if (e.getResponse().getStatusLine().getStatusCode() == RestStatus.NOT_FOUND.getStatus()) {
679+
return;
680+
}
681+
throw e;
682+
}
674683
Map<String, Object> jobs = entityAsMap(response);
675684
@SuppressWarnings("unchecked")
676685
List<Map<String, Object>> jobConfigs =

0 commit comments

Comments
 (0)