From d9ad66965cf8bfa3030407470a4c1b256d05e2b2 Mon Sep 17 00:00:00 2001 From: Armin Braun Date: Wed, 22 Jan 2020 11:38:20 +0100 Subject: [PATCH] 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 --- .../org/elasticsearch/test/rest/ESRestTestCase.java | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/test/framework/src/main/java/org/elasticsearch/test/rest/ESRestTestCase.java b/test/framework/src/main/java/org/elasticsearch/test/rest/ESRestTestCase.java index b16509df85037..758b71bd59fe2 100644 --- a/test/framework/src/main/java/org/elasticsearch/test/rest/ESRestTestCase.java +++ b/test/framework/src/main/java/org/elasticsearch/test/rest/ESRestTestCase.java @@ -670,7 +670,16 @@ private void wipeClusterSettings() throws IOException { } 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 jobs = entityAsMap(response); @SuppressWarnings("unchecked") List> jobConfigs =