From c65daac8708588f5ddfff21df3e8251bcc4aa38d Mon Sep 17 00:00:00 2001 From: Martijn van Groningen Date: Thu, 17 Dec 2020 13:57:54 +0100 Subject: [PATCH] Fix AutoFollowIT#testRolloverAliasInFollowClusterForbidden() test. (#66512) Backport of #66436 to 7.x branch. If the alias is missing then wrap the error in an assertion error, so that it can be retried by assertBusy(...) code block. Closes #66251 --- .../elasticsearch/xpack/ccr/AutoFollowIT.java | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/x-pack/plugin/ccr/qa/multi-cluster/src/test/java/org/elasticsearch/xpack/ccr/AutoFollowIT.java b/x-pack/plugin/ccr/qa/multi-cluster/src/test/java/org/elasticsearch/xpack/ccr/AutoFollowIT.java index 6680cfbf65616..1346aa87caed7 100644 --- a/x-pack/plugin/ccr/qa/multi-cluster/src/test/java/org/elasticsearch/xpack/ccr/AutoFollowIT.java +++ b/x-pack/plugin/ccr/qa/multi-cluster/src/test/java/org/elasticsearch/xpack/ccr/AutoFollowIT.java @@ -422,7 +422,6 @@ public void testRolloverDataStreamInFollowClusterForbidden() throws Exception { } } - @AwaitsFix(bugUrl = "https://github.com/elastic/elasticsearch/issues/66251") public void testRolloverAliasInFollowClusterForbidden() throws Exception { if ("follow".equals(targetCluster) == false) { return; @@ -499,13 +498,17 @@ private static void verifyAlias(RestClient client, String aliasName, boolean checkWriteIndex, String... otherIndices) throws IOException { - Request getAliasRequest = new Request("GET", "/_alias/" + aliasName); - Map responseBody = toMap(client.performRequest(getAliasRequest)); - if (checkWriteIndex) { - assertThat(ObjectPath.eval(otherIndices[0] + ".aliases." + aliasName + ".is_write_index", responseBody), is(true)); - } - for (String otherIndex : otherIndices) { - assertThat(ObjectPath.eval(otherIndex + ".aliases." + aliasName, responseBody), notNullValue()); + try { + Request getAliasRequest = new Request("GET", "/_alias/" + aliasName); + Map responseBody = toMap(client.performRequest(getAliasRequest)); + if (checkWriteIndex) { + assertThat(ObjectPath.eval(otherIndices[0] + ".aliases." + aliasName + ".is_write_index", responseBody), is(true)); + } + for (String otherIndex : otherIndices) { + assertThat(ObjectPath.eval(otherIndex + ".aliases." + aliasName, responseBody), notNullValue()); + } + } catch (ResponseException e) { + throw new AssertionError("get alias call failed", e); } }