Skip to content

Commit 76aa201

Browse files
committed
unmuted test
Relates to #37014
1 parent 1427203 commit 76aa201

File tree

3 files changed

+14
-4
lines changed

3 files changed

+14
-4
lines changed

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -568,9 +568,11 @@ static void removeCCRRelatedMetadataFromClusterState(ClusterService clusterServi
568568
clusterService.submitStateUpdateTask("remove-ccr-related-metadata", new ClusterStateUpdateTask() {
569569
@Override
570570
public ClusterState execute(ClusterState currentState) throws Exception {
571+
AutoFollowMetadata empty =
572+
new AutoFollowMetadata(Collections.emptyMap(), Collections.emptyMap(), Collections.emptyMap());
571573
ClusterState.Builder newState = ClusterState.builder(currentState);
572574
newState.metaData(MetaData.builder(currentState.getMetaData())
573-
.removeCustom(AutoFollowMetadata.TYPE)
575+
.putCustom(AutoFollowMetadata.TYPE, empty)
574576
.removeCustom(PersistentTasksCustomMetaData.TYPE)
575577
.build());
576578
return newState.build();

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,9 @@
1818
import org.elasticsearch.xpack.ccr.CcrSettings;
1919
import org.elasticsearch.xpack.ccr.LocalStateCcr;
2020
import org.elasticsearch.xpack.core.XPackSettings;
21+
import org.elasticsearch.xpack.core.ccr.AutoFollowStats;
2122
import org.elasticsearch.xpack.core.ccr.ShardFollowNodeTaskStatus;
23+
import org.elasticsearch.xpack.core.ccr.action.CcrStatsAction;
2224
import org.elasticsearch.xpack.core.ccr.action.FollowStatsAction;
2325
import org.elasticsearch.xpack.core.ccr.action.PutFollowAction;
2426
import org.elasticsearch.xpack.core.ccr.action.ResumeFollowAction;
@@ -79,6 +81,10 @@ public void removeLocalRemote() {
7981
assertAcked(client().admin().cluster().updateSettings(updateSettingsRequest).actionGet());
8082
}
8183

84+
protected AutoFollowStats getAutoFollowStats() {
85+
return client().execute(CcrStatsAction.INSTANCE, new CcrStatsAction.Request()).actionGet().getAutoFollowStats();
86+
}
87+
8288
protected ResumeFollowAction.Request getResumeFollowRequest(String followerIndex) {
8389
ResumeFollowAction.Request request = new ResumeFollowAction.Request();
8490
request.setFollowerIndex(followerIndex);

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

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,6 @@ public void testDoNotCreateFollowerIfLeaderDoesNotHaveSoftDeletes() throws Excep
9393
assertThat(client().admin().indices().prepareExists("follower-index").get().isExists(), equalTo(false));
9494
}
9595

96-
@AwaitsFix(bugUrl = "https://github.com/elastic/elasticsearch/issues/37014")
9796
public void testRemoveRemoteConnection() throws Exception {
9897
PutAutoFollowPatternAction.Request request = new PutAutoFollowPatternAction.Request();
9998
request.setName("my_pattern");
@@ -102,6 +101,7 @@ public void testRemoveRemoteConnection() throws Exception {
102101
request.setFollowIndexNamePattern("copy-{{leader_index}}");
103102
request.setReadPollTimeout(TimeValue.timeValueMillis(10));
104103
assertTrue(client().execute(PutAutoFollowPatternAction.INSTANCE, request).actionGet().isAcknowledged());
104+
long previousNumberOfSuccessfulFollowedIndices = getAutoFollowStats().getNumberOfSuccessfulFollowIndices();
105105

106106
Settings leaderIndexSettings = Settings.builder()
107107
.put(IndexSettings.INDEX_SOFT_DELETES_SETTING.getKey(), true)
@@ -112,7 +112,8 @@ public void testRemoveRemoteConnection() throws Exception {
112112
client().prepareIndex("logs-20200101", "doc").setSource("{}", XContentType.JSON).get();
113113
assertBusy(() -> {
114114
CcrStatsAction.Response response = client().execute(CcrStatsAction.INSTANCE, new CcrStatsAction.Request()).actionGet();
115-
assertThat(response.getAutoFollowStats().getNumberOfSuccessfulFollowIndices(), equalTo(1L));
115+
assertThat(response.getAutoFollowStats().getNumberOfSuccessfulFollowIndices(),
116+
equalTo(previousNumberOfSuccessfulFollowedIndices + 1));
116117
assertThat(response.getFollowStats().getStatsResponses().size(), equalTo(1));
117118
assertThat(response.getFollowStats().getStatsResponses().get(0).status().followerGlobalCheckpoint(), equalTo(0L));
118119
});
@@ -128,7 +129,8 @@ public void testRemoveRemoteConnection() throws Exception {
128129
client().prepareIndex("logs-20200101", "doc").setSource("{}", XContentType.JSON).get();
129130
assertBusy(() -> {
130131
CcrStatsAction.Response response = client().execute(CcrStatsAction.INSTANCE, new CcrStatsAction.Request()).actionGet();
131-
assertThat(response.getAutoFollowStats().getNumberOfSuccessfulFollowIndices(), equalTo(2L));
132+
assertThat(response.getAutoFollowStats().getNumberOfSuccessfulFollowIndices(),
133+
equalTo(previousNumberOfSuccessfulFollowedIndices + 2));
132134

133135
FollowStatsAction.StatsRequest statsRequest = new FollowStatsAction.StatsRequest();
134136
statsRequest.setIndices(new String[]{"copy-logs-20200101"});

0 commit comments

Comments
 (0)