Skip to content

Commit

Permalink
Fix AutoFollowIT#testRolloverAliasInFollowClusterForbidden() test. (#…
Browse files Browse the repository at this point in the history
…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
  • Loading branch information
martijnvg authored Dec 17, 2020
1 parent a318a80 commit c65daac
Showing 1 changed file with 11 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
}
}

Expand Down

0 comments on commit c65daac

Please sign in to comment.