Skip to content

Commit aa421e0

Browse files
committed
Adapt testFollowStatsApiIncludeShardFollowStatsWithRemovedFollowerIndex (elastic#44801)
This commit unmutes and renames the test that failed on CI (elastic#44796) after elastic#44702 has been merged. This test assumes that follow stats still exist after a follower index has been deleted. The follow stats are based on persistent tasks, and since elastic#44702 the persistent tasks of deleted following indices are now automatically cleaned up to avoid to bloat the cluster state. I don't think we should report any follow stats for deleted indices and I don't think that this test makes much sense now the tasks are cleaned up. This is why the test has been renamed. closes elastic#44796
1 parent c6c11f9 commit aa421e0

File tree

1 file changed

+8
-15
lines changed

1 file changed

+8
-15
lines changed

x-pack/plugin/ccr/src/test/java/org/elasticsearch/xpack/ccr/FollowStatsIT.java

Lines changed: 8 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcked;
3131
import static org.elasticsearch.xpack.ccr.LocalIndexFollowingIT.getIndexSettings;
3232
import static org.hamcrest.Matchers.equalTo;
33+
import static org.hamcrest.Matchers.hasSize;
3334
import static org.hamcrest.collection.IsEmptyCollection.empty;
3435

3536
/*
@@ -149,9 +150,8 @@ public void testFollowStatsApiResourceNotFound() throws Exception {
149150
assertAcked(client().execute(PauseFollowAction.INSTANCE, new PauseFollowAction.Request("follower1")).actionGet());
150151
}
151152

152-
public void testFollowStatsApiIncludeShardFollowStatsWithRemovedFollowerIndex() throws Exception {
153-
final String leaderIndexSettings = getIndexSettings(1, 0,
154-
singletonMap(IndexSettings.INDEX_SOFT_DELETES_SETTING.getKey(), "true"));
153+
public void testFollowStatsApiWithDeletedFollowerIndex() throws Exception {
154+
final String leaderIndexSettings = getIndexSettings(1, 0, singletonMap(IndexSettings.INDEX_SOFT_DELETES_SETTING.getKey(), "true"));
155155
assertAcked(client().admin().indices().prepareCreate("leader1").setSource(leaderIndexSettings, XContentType.JSON));
156156
ensureGreen("leader1");
157157

@@ -171,18 +171,11 @@ public void testFollowStatsApiIncludeShardFollowStatsWithRemovedFollowerIndex()
171171

172172
assertAcked(client().admin().indices().delete(new DeleteIndexRequest("follower1")).actionGet());
173173

174-
statsRequest = new FollowStatsAction.StatsRequest();
175-
response = client().execute(FollowStatsAction.INSTANCE, statsRequest).actionGet();
176-
assertThat(response.getStatsResponses().size(), equalTo(1));
177-
assertThat(response.getStatsResponses().get(0).status().followerIndex(), equalTo("follower1"));
178-
179-
statsRequest = new FollowStatsAction.StatsRequest();
180-
statsRequest.setIndices(new String[] {"follower1"});
181-
response = client().execute(FollowStatsAction.INSTANCE, statsRequest).actionGet();
182-
assertThat(response.getStatsResponses().size(), equalTo(1));
183-
assertThat(response.getStatsResponses().get(0).status().followerIndex(), equalTo("follower1"));
184-
185-
assertAcked(client().execute(PauseFollowAction.INSTANCE, new PauseFollowAction.Request("follower1")).actionGet());
174+
assertBusy(() -> {
175+
FollowStatsAction.StatsRequest request = new FollowStatsAction.StatsRequest();
176+
FollowStatsAction.StatsResponses statsResponse = client().execute(FollowStatsAction.INSTANCE, request).actionGet();
177+
assertThat(statsResponse.getStatsResponses(), hasSize(0));
178+
});
186179
}
187180

188181
public void testFollowStatsApiIncludeShardFollowStatsWithClosedFollowerIndex() throws Exception {

0 commit comments

Comments
 (0)