Skip to content

Commit

Permalink
[TEST] Ensure shard follow tasks have really stopped.
Browse files Browse the repository at this point in the history
Relates to #36696
  • Loading branch information
martijnvg committed Dec 18, 2018
1 parent 8a412c6 commit 57e1a4b
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,13 @@ public void setupLocalRemote() {
}

@After
public void remoteLocalRemote() throws Exception {
public void purgeCCRMetadata() throws Exception {
ClusterService clusterService = getInstanceFromNode(ClusterService.class);
removeCCRRelatedMetadataFromClusterState(clusterService);
}

@After
public void removeLocalRemote() {
ClusterUpdateSettingsRequest updateSettingsRequest = new ClusterUpdateSettingsRequest();
updateSettingsRequest.transientSettings(Settings.builder().put("cluster.remote.local.seeds", (String) null));
assertAcked(client().admin().cluster().updateSettings(updateSettingsRequest).actionGet());
Expand All @@ -70,8 +73,8 @@ public void remoteLocalRemote() throws Exception {
protected ResumeFollowAction.Request getResumeFollowRequest(String followerIndex) {
ResumeFollowAction.Request request = new ResumeFollowAction.Request();
request.setFollowerIndex(followerIndex);
request.setMaxRetryDelay(TimeValue.timeValueMillis(10));
request.setReadPollTimeout(TimeValue.timeValueMillis(10));
request.setMaxRetryDelay(TimeValue.timeValueMillis(1));
request.setReadPollTimeout(TimeValue.timeValueMillis(1));
return request;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,13 @@
import org.elasticsearch.index.IndexSettings;
import org.elasticsearch.persistent.PersistentTasksCustomMetaData;
import org.elasticsearch.xpack.CcrSingleNodeTestCase;
import org.elasticsearch.xpack.core.ccr.action.CcrStatsAction;
import org.elasticsearch.xpack.core.ccr.action.FollowStatsAction;
import org.elasticsearch.xpack.core.ccr.action.PauseFollowAction;
import org.elasticsearch.xpack.core.ccr.action.PutFollowAction;

import java.util.Comparator;
import java.util.List;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.atomic.AtomicBoolean;

Expand Down Expand Up @@ -106,6 +108,12 @@ public void testFollowStatsApiFollowerIndexFiltering() throws Exception {

assertAcked(client().execute(PauseFollowAction.INSTANCE, new PauseFollowAction.Request("follower1")).actionGet());
assertAcked(client().execute(PauseFollowAction.INSTANCE, new PauseFollowAction.Request("follower2")).actionGet());

assertBusy(() -> {
List<FollowStatsAction.StatsResponse> responseList =
client().execute(CcrStatsAction.INSTANCE, new CcrStatsAction.Request()).actionGet().getFollowStats().getStatsResponses();
assertThat(responseList.size(), equalTo(0));
});
}

}

0 comments on commit 57e1a4b

Please sign in to comment.