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);