From fb2f6da011606f954d2e0efde467c79abfd55305 Mon Sep 17 00:00:00 2001 From: jaymode Date: Thu, 10 Dec 2020 09:31:11 -0700 Subject: [PATCH 1/2] Update deprecation messages for synced flush This commit updates the deprecation messages that are expected on master to account for the change to the synced flush deprecation message that was modified in #66130. --- .../test/java/org/elasticsearch/backwards/IndexingIT.java | 6 +++++- .../java/org/elasticsearch/test/rest/ESRestTestCase.java | 5 ++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/qa/mixed-cluster/src/test/java/org/elasticsearch/backwards/IndexingIT.java b/qa/mixed-cluster/src/test/java/org/elasticsearch/backwards/IndexingIT.java index 182e8f15d542..0e07c7cc238d 100644 --- a/qa/mixed-cluster/src/test/java/org/elasticsearch/backwards/IndexingIT.java +++ b/qa/mixed-cluster/src/test/java/org/elasticsearch/backwards/IndexingIT.java @@ -44,6 +44,7 @@ import static org.hamcrest.Matchers.contains; import static org.hamcrest.Matchers.equalTo; +import static org.hamcrest.Matchers.oneOf; public class IndexingIT extends ESRestTestCase { @@ -303,7 +304,10 @@ public void testSyncedFlushTransition() throws Exception { ResponseException responseException = expectThrows(ResponseException.class, () -> oldNodeClient.performRequest(request)); assertThat(responseException.getResponse().getStatusLine().getStatusCode(), equalTo(RestStatus.CONFLICT.getStatus())); assertThat(responseException.getResponse().getWarnings(), - contains("Synced flush is deprecated and will be removed in 8.0. Use flush at _/flush or /{index}/_flush instead.")); + oneOf( + contains("Synced flush is deprecated and will be removed in 8.0. Use flush at _/flush or /{index}/_flush instead."), + contains("Synced flush is deprecated and will be removed in 8.0. Use flush at /_flush or /{index}/_flush instead.") + )); Map result = ObjectPath.createFromResponse(responseException.getResponse()).evaluate("_shards"); assertThat(result.get("total"), equalTo(totalShards)); assertThat(result.get("successful"), equalTo(0)); 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 b5fccdaa9f9e..c4847a57751a 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 @@ -1433,13 +1433,16 @@ protected static Version minimumNodeVersion() throws IOException { protected void syncedFlush(String indexName) throws Exception { final List deprecationMessages = List.of( "Synced flush is deprecated and will be removed in 8.0. Use flush at _/flush or /{index}/_flush instead."); + final List fixedDeprecationMessages = List.of( + "Synced flush is deprecated and will be removed in 8.0. Use flush at /_flush or /{index}/_flush instead."); final List transitionMessages = List.of( "Synced flush was removed and a normal flush was performed instead. This transition will be removed in a future version."); final WarningsHandler warningsHandler; if (minimumNodeVersion().onOrAfter(Version.V_8_0_0)) { warningsHandler = warnings -> warnings.equals(transitionMessages) == false; } else if (minimumNodeVersion().onOrAfter(Version.V_7_6_0)) { - warningsHandler = warnings -> warnings.equals(deprecationMessages) == false && warnings.equals(transitionMessages) == false; + warningsHandler = warnings -> warnings.equals(deprecationMessages) == false && warnings.equals(transitionMessages) == false && + warnings.equals(fixedDeprecationMessages) == false; } else if (nodeVersions.stream().anyMatch(n -> n.onOrAfter(Version.V_8_0_0))) { warningsHandler = warnings -> warnings.isEmpty() == false && warnings.equals(transitionMessages) == false; } else { From 1cf3318c52416cff57d6d5a3ed4fb4c7a1d1bc4f Mon Sep 17 00:00:00 2001 From: jaymode Date: Thu, 10 Dec 2020 09:57:21 -0700 Subject: [PATCH 2/2] reverse order of matchers --- .../test/java/org/elasticsearch/backwards/IndexingIT.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/qa/mixed-cluster/src/test/java/org/elasticsearch/backwards/IndexingIT.java b/qa/mixed-cluster/src/test/java/org/elasticsearch/backwards/IndexingIT.java index 0e07c7cc238d..0837a6377c32 100644 --- a/qa/mixed-cluster/src/test/java/org/elasticsearch/backwards/IndexingIT.java +++ b/qa/mixed-cluster/src/test/java/org/elasticsearch/backwards/IndexingIT.java @@ -304,9 +304,9 @@ public void testSyncedFlushTransition() throws Exception { ResponseException responseException = expectThrows(ResponseException.class, () -> oldNodeClient.performRequest(request)); assertThat(responseException.getResponse().getStatusLine().getStatusCode(), equalTo(RestStatus.CONFLICT.getStatus())); assertThat(responseException.getResponse().getWarnings(), - oneOf( - contains("Synced flush is deprecated and will be removed in 8.0. Use flush at _/flush or /{index}/_flush instead."), - contains("Synced flush is deprecated and will be removed in 8.0. Use flush at /_flush or /{index}/_flush instead.") + contains( + oneOf("Synced flush is deprecated and will be removed in 8.0. Use flush at _/flush or /{index}/_flush instead.", + "Synced flush is deprecated and will be removed in 8.0. Use flush at /_flush or /{index}/_flush instead.") )); Map result = ObjectPath.createFromResponse(responseException.getResponse()).evaluate("_shards"); assertThat(result.get("total"), equalTo(totalShards));