From 922c82ff64fb19f9e7016875438d95ed55cfc2d7 Mon Sep 17 00:00:00 2001 From: Jay Modi Date: Thu, 10 Dec 2020 12:23:18 -0700 Subject: [PATCH] Update deprecation messages for synced flush (#66181) 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 182e8f15d5420..0837a6377c323 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.")); + 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)); 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 b5fccdaa9f9ed..c4847a57751a3 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 {