Skip to content

Commit 6da66c6

Browse files
Fix Rest Tests Failing to Cleanup Rollup Jobs (#51246)
* 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 fac1247 commit 6da66c6

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
@@ -663,7 +663,16 @@ private void wipeClusterSettings() throws IOException {
663663
}
664664

665665
private void wipeRollupJobs() throws IOException {
666-
Response response = adminClient().performRequest(new Request("GET", "/_rollup/job/_all"));
666+
final Response response;
667+
try {
668+
response = adminClient().performRequest(new Request("GET", "/_rollup/job/_all"));
669+
} catch (ResponseException e) {
670+
// If we don't see the rollup endpoint (possibly because of running against an older ES version) we just bail
671+
if (e.getResponse().getStatusLine().getStatusCode() == RestStatus.NOT_FOUND.getStatus()) {
672+
return;
673+
}
674+
throw e;
675+
}
667676
Map<String, Object> jobs = entityAsMap(response);
668677
@SuppressWarnings("unchecked")
669678
List<Map<String, Object>> jobConfigs =

0 commit comments

Comments
 (0)