Skip to content

Commit

Permalink
Update deprecation messages for synced flush (elastic#66181)
Browse files Browse the repository at this point in the history
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 elastic#66130.
  • Loading branch information
jaymode authored Dec 10, 2020
1 parent 9c99b5b commit 922c82f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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 {

Expand Down Expand Up @@ -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<String, Object> result = ObjectPath.createFromResponse(responseException.getResponse()).evaluate("_shards");
assertThat(result.get("total"), equalTo(totalShards));
assertThat(result.get("successful"), equalTo(0));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1433,13 +1433,16 @@ protected static Version minimumNodeVersion() throws IOException {
protected void syncedFlush(String indexName) throws Exception {
final List<String> deprecationMessages = List.of(
"Synced flush is deprecated and will be removed in 8.0. Use flush at _/flush or /{index}/_flush instead.");
final List<String> fixedDeprecationMessages = List.of(
"Synced flush is deprecated and will be removed in 8.0. Use flush at /_flush or /{index}/_flush instead.");
final List<String> 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 {
Expand Down

0 comments on commit 922c82f

Please sign in to comment.