Skip to content

Commit a3cf281

Browse files
authored
Made small modifications to ESRestTestCase. (#70544)
Backporting #70531 to the 7.12 branch. * Don't try to invoke delete component/index templates APIs if there are no templates to delete. * Don't delete deprecation templates by marking these as xpack templates. Relates to #69973
1 parent de82200 commit a3cf281

File tree

1 file changed

+11
-9
lines changed

1 file changed

+11
-9
lines changed

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

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -615,12 +615,12 @@ private void wipeCluster() throws Exception {
615615
.collect(Collectors.toList());
616616
for (String name : names) {
617617
if (isXPackTemplate(name)) {
618-
continue;
618+
continue;
619619
}
620-
try {
621-
adminClient().performRequest(new Request("DELETE", "_index_template/" + name));
622-
} catch (ResponseException e) {
623-
logger.debug(new ParameterizedMessage("unable to remove index template {}", name), e);
620+
try {
621+
adminClient().performRequest(new Request("DELETE", "_index_template/" + name));
622+
} catch (ResponseException e) {
623+
logger.warn(new ParameterizedMessage("unable to remove index template {}", name), e);
624624
}
625625
}
626626
} catch (Exception e) {
@@ -642,7 +642,7 @@ private void wipeCluster() throws Exception {
642642
}
643643
adminClient().performRequest(new Request("DELETE", "_component_template/" + componentTemplate));
644644
} catch (ResponseException e) {
645-
logger.debug(new ParameterizedMessage("unable to remove component template {}", componentTemplate), e);
645+
logger.warn(new ParameterizedMessage("unable to remove component template {}", componentTemplate), e);
646646
}
647647
}
648648
} catch (Exception e) {
@@ -662,7 +662,7 @@ private void wipeCluster() throws Exception {
662662
try {
663663
adminClient().performRequest(new Request("DELETE", "_template/" + name));
664664
} catch (ResponseException e) {
665-
logger.debug(new ParameterizedMessage("unable to remove index template {}", name), e);
665+
logger.warn(new ParameterizedMessage("unable to remove index template {}", name), e);
666666
}
667667
}
668668
} else {
@@ -1421,13 +1421,15 @@ protected static boolean isXPackTemplate(String name) {
14211421
if (name.startsWith(".transform-")) {
14221422
return true;
14231423
}
1424+
if (name.startsWith(".deprecation-")) {
1425+
return true;
1426+
}
14241427
switch (name) {
14251428
case ".watches":
14261429
case "security_audit_log":
14271430
case ".slm-history":
14281431
case ".async-search":
14291432
case "saml-service-provider":
1430-
case "ilm-history":
14311433
case "logs":
14321434
case "logs-settings":
14331435
case "logs-mappings":
@@ -1438,7 +1440,7 @@ protected static boolean isXPackTemplate(String name) {
14381440
case "synthetics-settings":
14391441
case "synthetics-mappings":
14401442
case ".snapshot-blob-cache":
1441-
case ".deprecation-indexing-template":
1443+
case "ilm-history":
14421444
case "logstash-index-template":
14431445
case "security-index-template":
14441446
return true;

0 commit comments

Comments
 (0)