Skip to content

Commit 597194c

Browse files
authored
Adapt testFollowStatsApiIncludeShardFollowStatsWithRemovedFollowerIndex (#44801)
This commit unmutes and renames the test that failed on CI (#44796) after #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 #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 #44796
1 parent dafd7b0 commit 597194c

File tree

1 file changed

+8
-16
lines changed

1 file changed

+8
-16
lines changed

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

Lines changed: 8 additions & 16 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,10 +150,8 @@ public void testFollowStatsApiResourceNotFound() throws Exception {
149150
assertAcked(client().execute(PauseFollowAction.INSTANCE, new PauseFollowAction.Request("follower1")).actionGet());
150151
}
151152

152-
@AwaitsFix(bugUrl = "https://github.com/elastic/elasticsearch/issues/44796")
153-
public void testFollowStatsApiIncludeShardFollowStatsWithRemovedFollowerIndex() throws Exception {
154-
final String leaderIndexSettings = getIndexSettings(1, 0,
155-
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"));
156155
assertAcked(client().admin().indices().prepareCreate("leader1").setSource(leaderIndexSettings, XContentType.JSON));
157156
ensureGreen("leader1");
158157

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

173172
assertAcked(client().admin().indices().delete(new DeleteIndexRequest("follower1")).actionGet());
174173

175-
statsRequest = new FollowStatsAction.StatsRequest();
176-
response = client().execute(FollowStatsAction.INSTANCE, statsRequest).actionGet();
177-
assertThat(response.getStatsResponses().size(), equalTo(1));
178-
assertThat(response.getStatsResponses().get(0).status().followerIndex(), equalTo("follower1"));
179-
180-
statsRequest = new FollowStatsAction.StatsRequest();
181-
statsRequest.setIndices(new String[] {"follower1"});
182-
response = client().execute(FollowStatsAction.INSTANCE, statsRequest).actionGet();
183-
assertThat(response.getStatsResponses().size(), equalTo(1));
184-
assertThat(response.getStatsResponses().get(0).status().followerIndex(), equalTo("follower1"));
185-
186-
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+
});
187179
}
188180

189181
public void testFollowStatsApiIncludeShardFollowStatsWithClosedFollowerIndex() throws Exception {

0 commit comments

Comments
 (0)