[7.x] Be lenient when deleting index and component templates a… (#54538)
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
This commit is contained in:
parent
0f312c8b38
commit
987b6ecffa
|
@ -582,11 +582,7 @@ public abstract class ESRestTestCase extends ESTestCase {
|
||||||
adminClient().performRequest(new Request("DELETE", "_index_template/*"));
|
adminClient().performRequest(new Request("DELETE", "_index_template/*"));
|
||||||
adminClient().performRequest(new Request("DELETE", "_component_template/*"));
|
adminClient().performRequest(new Request("DELETE", "_component_template/*"));
|
||||||
} catch (ResponseException e) {
|
} catch (ResponseException e) {
|
||||||
if (e.getResponse().getStatusLine().getStatusCode() == 405 || e.getResponse().getStatusLine().getStatusCode() == 500) {
|
// We hit a version of ES that doesn't support index templates v2 yet, so it's safe to ignore
|
||||||
// We hit a version of ES that doesn't support index templates v2 yet, so it's safe to ignore
|
|
||||||
} else {
|
|
||||||
throw e;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
logger.debug("Clearing all templates");
|
logger.debug("Clearing all templates");
|
||||||
|
@ -595,11 +591,7 @@ public abstract class ESRestTestCase extends ESTestCase {
|
||||||
adminClient().performRequest(new Request("DELETE", "_index_template/*"));
|
adminClient().performRequest(new Request("DELETE", "_index_template/*"));
|
||||||
adminClient().performRequest(new Request("DELETE", "_component_template/*"));
|
adminClient().performRequest(new Request("DELETE", "_component_template/*"));
|
||||||
} catch (ResponseException e) {
|
} catch (ResponseException e) {
|
||||||
if (e.getResponse().getStatusLine().getStatusCode() == 405 || e.getResponse().getStatusLine().getStatusCode() == 500) {
|
// We hit a version of ES that doesn't support index templates v2 yet, so it's safe to ignore
|
||||||
// We hit a version of ES that doesn't support index templates v2 yet, so it's safe to ignore
|
|
||||||
} else {
|
|
||||||
throw e;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue