|
@@ -576,7 +576,7 @@ public class IndexFollowingIT extends CcrIntegTestCase {
|
|
|
|
|
|
public void testUnfollowNonExistingIndex() {
|
|
|
PauseFollowAction.Request unfollowRequest = new PauseFollowAction.Request("non-existing-index");
|
|
|
- expectThrows(IllegalArgumentException.class,
|
|
|
+ expectThrows(IndexNotFoundException.class,
|
|
|
() -> followerClient().execute(PauseFollowAction.INSTANCE, unfollowRequest).actionGet());
|
|
|
}
|
|
|
|
|
@@ -817,6 +817,27 @@ public class IndexFollowingIT extends CcrIntegTestCase {
|
|
|
ensureNoCcrTasks();
|
|
|
}
|
|
|
|
|
|
+ public void testPauseIndex() throws Exception {
|
|
|
+ assertAcked(leaderClient().admin().indices().prepareCreate("leader")
|
|
|
+ .setSettings(Settings.builder()
|
|
|
+ .put(IndexSettings.INDEX_SOFT_DELETES_SETTING.getKey(), true)
|
|
|
+ .put(IndexMetaData.SETTING_NUMBER_OF_SHARDS, 1)
|
|
|
+ .put(IndexMetaData.SETTING_NUMBER_OF_REPLICAS, 0)
|
|
|
+ .build()));
|
|
|
+ followerClient().execute(PutFollowAction.INSTANCE, putFollow("leader", "follower")).get();
|
|
|
+ assertAcked(followerClient().admin().indices().prepareCreate("regular-index"));
|
|
|
+ assertAcked(followerClient().execute(PauseFollowAction.INSTANCE, new PauseFollowAction.Request("follower")).actionGet());
|
|
|
+ assertThat(expectThrows(IllegalArgumentException.class, () -> followerClient().execute(
|
|
|
+ PauseFollowAction.INSTANCE, new PauseFollowAction.Request("follower")).actionGet()).getMessage(),
|
|
|
+ equalTo("no shard follow tasks for [follower]"));
|
|
|
+ assertThat(expectThrows(IllegalArgumentException.class, () -> followerClient().execute(
|
|
|
+ PauseFollowAction.INSTANCE, new PauseFollowAction.Request("regular-index")).actionGet()).getMessage(),
|
|
|
+ equalTo("index [regular-index] is not a follower index"));
|
|
|
+ assertThat(expectThrows(IndexNotFoundException.class, () -> followerClient().execute(
|
|
|
+ PauseFollowAction.INSTANCE, new PauseFollowAction.Request("xyz")).actionGet()).getMessage(),
|
|
|
+ equalTo("no such index [xyz]"));
|
|
|
+ }
|
|
|
+
|
|
|
public void testUnfollowIndex() throws Exception {
|
|
|
String leaderIndexSettings = getIndexSettings(1, 0, singletonMap(IndexSettings.INDEX_SOFT_DELETES_SETTING.getKey(), "true"));
|
|
|
assertAcked(leaderClient().admin().indices().prepareCreate("index1").setSource(leaderIndexSettings, XContentType.JSON).get());
|