| 
26 | 26 | import org.apache.http.ssl.SSLContextBuilder;  | 
27 | 27 | import org.apache.http.ssl.SSLContexts;  | 
28 | 28 | import org.apache.http.util.EntityUtils;  | 
 | 29 | +import org.apache.logging.log4j.LogManager;  | 
 | 30 | +import org.apache.logging.log4j.Logger;  | 
29 | 31 | import org.elasticsearch.Build;  | 
30 | 32 | import org.elasticsearch.TransportVersion;  | 
31 | 33 | import org.elasticsearch.TransportVersions;  | 
 | 
125 | 127 | import java.util.function.Supplier;  | 
126 | 128 | import java.util.regex.Pattern;  | 
127 | 129 | import java.util.stream.Collectors;  | 
128 |  | - | 
129 | 130 | import javax.net.ssl.SSLContext;  | 
130 | 131 | 
 
  | 
131 | 132 | import static java.util.Collections.sort;  | 
@@ -160,6 +161,8 @@ public abstract class ESRestTestCase extends ESTestCase {  | 
160 | 161 | 
 
  | 
161 | 162 |     private static final Pattern SEMANTIC_VERSION_PATTERN = Pattern.compile("^(\\d+\\.\\d+\\.\\d+)\\D?.*");  | 
162 | 163 | 
 
  | 
 | 164 | +    private static final Logger SUITE_LOGGER = LogManager.getLogger(ESRestTestCase.class);  | 
 | 165 | + | 
163 | 166 |     /**  | 
164 | 167 |      * Convert the entity from a {@link Response} into a map of maps.  | 
165 | 168 |      * Consumes the underlying HttpEntity, releasing any resources it may be holding.  | 
@@ -1131,6 +1134,19 @@ protected static void wipeAllIndices(boolean preserveSecurityIndices) throws IOE  | 
1131 | 1134 |             }  | 
1132 | 1135 |             final Request deleteRequest = new Request("DELETE", Strings.collectionToCommaDelimitedString(indexPatterns));  | 
1133 | 1136 |             deleteRequest.addParameter("expand_wildcards", "open,closed,hidden");  | 
 | 1137 | + | 
 | 1138 | +            //If system index warning, ignore but log  | 
 | 1139 | +            deleteRequest.setOptions(RequestOptions.DEFAULT.toBuilder().setWarningsHandler(warnings -> {  | 
 | 1140 | +                for (String warning : warnings) {  | 
 | 1141 | +                    if (warning.startsWith("this request accesses system indices:")) {  | 
 | 1142 | +                        SUITE_LOGGER.warn("Ignoring system index access warning during test cleanup: {}", warning);  | 
 | 1143 | +                    } else {  | 
 | 1144 | +                        return true;  | 
 | 1145 | +                    }  | 
 | 1146 | +                }  | 
 | 1147 | +                return false;  | 
 | 1148 | +            }));  | 
 | 1149 | + | 
1134 | 1150 |             final Response response = adminClient().performRequest(deleteRequest);  | 
1135 | 1151 |             try (InputStream is = response.getEntity().getContent()) {  | 
1136 | 1152 |                 assertTrue((boolean) XContentHelper.convertToMap(XContentType.JSON.xContent(), is, true).get("acknowledged"));  | 
 | 
0 commit comments