From 11cef15b83d86ccc460d32b46f21b60333f49dbd Mon Sep 17 00:00:00 2001 From: Martijn van Groningen Date: Thu, 17 Sep 2020 11:04:05 +0200 Subject: [PATCH] Ignore 404 when wiping data streams. (#62492) Backport of #62484 to 7.x branch. It is possible in mixed version clusters (nodes prior to 7.10) that a 404 is returned when wiping all data streams. This is because there are no data streams and the coordinator node is on a version that doesn't mark the delete request for wildcard usage. --- .../java/org/elasticsearch/test/rest/ESRestTestCase.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) 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 bc41b9de2ba..1da1e7018e6 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 @@ -695,8 +695,10 @@ public abstract class ESRestTestCase extends ESTestCase { adminClient().performRequest(new Request("DELETE", "_data_stream/*")); } } catch (ResponseException e) { - // We hit a version of ES that doesn't have data streams enabled so it's safe to ignore - if (e.getResponse().getStatusLine().getStatusCode() != 405 && e.getResponse().getStatusLine().getStatusCode() != 500) { + // We hit a version of ES that doesn't serialize DeleteDataStreamAction.Request#wildcardExpressionsOriginallySpecified field or + // that doesn't support data streams so it's safe to ignore + int statusCode = e.getResponse().getStatusLine().getStatusCode(); + if (org.elasticsearch.common.collect.Set.of(404, 405, 500).contains(statusCode) == false) { throw e; } }