From 3859410f162e90c68ec347973af44c48bec78fcc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Francisco=20Fern=C3=A1ndez=20Casta=C3=B1o?= Date: Mon, 7 Jun 2021 13:37:32 +0200 Subject: [PATCH] Fix AutoFollowCoordinatorTests#testExcludedPatternIndicesAreNotAutoFollowed Use an empty ClusterState as a base cluster state to take into account the case where no leader candidate indices are created Closes #73797 Relates #72935 Backport of #73811 --- .../xpack/ccr/action/AutoFollowCoordinatorTests.java | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/x-pack/plugin/ccr/src/test/java/org/elasticsearch/xpack/ccr/action/AutoFollowCoordinatorTests.java b/x-pack/plugin/ccr/src/test/java/org/elasticsearch/xpack/ccr/action/AutoFollowCoordinatorTests.java index 0e0e728938d02..a35f7f44532b0 100644 --- a/x-pack/plugin/ccr/src/test/java/org/elasticsearch/xpack/ccr/action/AutoFollowCoordinatorTests.java +++ b/x-pack/plugin/ccr/src/test/java/org/elasticsearch/xpack/ccr/action/AutoFollowCoordinatorTests.java @@ -2089,15 +2089,11 @@ public void testExcludedPatternIndicesAreNotAutoFollowed() { Collections.singletonMap(pattern, emptyMap())))) .build(); - ClusterState remoteState = null; + ClusterState remoteState = ClusterState.EMPTY_STATE; final int nbLeaderIndices = randomIntBetween(0, 15); for (int i = 0; i < nbLeaderIndices; i++) { String indexName = "docs-" + i; - if (remoteState == null) { - remoteState = createRemoteClusterState(indexName, true); - } else { - remoteState = createRemoteClusterState(remoteState, indexName); - } + remoteState = createRemoteClusterState(remoteState, indexName); } final int nbLeaderExcludedIndices = randomIntBetween(1, 15);