diff --git a/x-pack/plugin/ccr/src/test/java/org/elasticsearch/xpack/ccr/AutoFollowIT.java b/x-pack/plugin/ccr/src/test/java/org/elasticsearch/xpack/ccr/AutoFollowIT.java index 1db42dba44e77..286e5badee133 100644 --- a/x-pack/plugin/ccr/src/test/java/org/elasticsearch/xpack/ccr/AutoFollowIT.java +++ b/x-pack/plugin/ccr/src/test/java/org/elasticsearch/xpack/ccr/AutoFollowIT.java @@ -139,7 +139,13 @@ public void testAutoFollowManyIndices() throws Exception { assertThat(autoFollowStats.getNumberOfSuccessfulFollowIndices(), equalTo((long) expectedVal1)); }); + // Delete auto follow pattern and make sure that in the background the auto follower has stopped + // then the leader index created after that should never be auto followed: deleteAutoFollowPatternSetting(); + assertBusy(() -> { + AutoFollowStats autoFollowStats = getAutoFollowStats(); + assertThat(autoFollowStats.getAutoFollowedClusters().size(), equalTo(0)); + }); createLeaderIndex("logs-does-not-count", leaderIndexSettings); putAutoFollowPatterns("my-pattern", new String[] {"logs-*"});