[TEST] Ensure shard follow tasks have really stopped.

Relates to #36696
This commit is contained in:
Martijn van Groningen 2018-12-18 10:43:11 +01:00
parent 8a412c6a26
commit 57e1a4bc9f
No known key found for this signature in database
GPG Key ID: AB236F4FCF2AF12A
2 changed files with 14 additions and 3 deletions

View File

@ -58,10 +58,13 @@ public abstract class CcrSingleNodeTestCase extends ESSingleNodeTestCase {
}
@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());
@ -70,8 +73,8 @@ public abstract class CcrSingleNodeTestCase extends ESSingleNodeTestCase {
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;
}

View File

@ -13,11 +13,13 @@ import org.elasticsearch.common.xcontent.XContentType;
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;
@ -106,6 +108,12 @@ public class FollowStatsIT extends CcrSingleNodeTestCase {
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));
});
}
}