Skip to content

Commit d6f9d7b

Browse files
authored
Be lenient when deleting index and component templates after t… (#54517)
We previously checked for a 405 response, but on 7.x BWC tests may be hitting versions that don't support the 405 response (returning 400 or 500), so be more lenient in those cases. Relates to #54513
1 parent 7144024 commit d6f9d7b

File tree

1 file changed

+2
-10
lines changed

1 file changed

+2
-10
lines changed

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

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -553,11 +553,7 @@ private void wipeCluster() throws Exception {
553553
adminClient().performRequest(new Request("DELETE", "_index_template/*"));
554554
adminClient().performRequest(new Request("DELETE", "_component_template/*"));
555555
} catch (ResponseException e) {
556-
if (e.getResponse().getStatusLine().getStatusCode() == 405) {
557-
// We hit a version of ES that doesn't support index templates v2 yet, so it's safe to ignore
558-
} else {
559-
throw e;
560-
}
556+
// We hit a version of ES that doesn't support index templates v2 yet, so it's safe to ignore
561557
}
562558
} else {
563559
logger.debug("Clearing all templates");
@@ -566,11 +562,7 @@ private void wipeCluster() throws Exception {
566562
adminClient().performRequest(new Request("DELETE", "_index_template/*"));
567563
adminClient().performRequest(new Request("DELETE", "_component_template/*"));
568564
} catch (ResponseException e) {
569-
if (e.getResponse().getStatusLine().getStatusCode() == 405) {
570-
// We hit a version of ES that doesn't support index templates v2 yet, so it's safe to ignore
571-
} else {
572-
throw e;
573-
}
565+
// We hit a version of ES that doesn't support index templates v2 yet, so it's safe to ignore
574566
}
575567
}
576568
}

0 commit comments

Comments
 (0)