@@ -577,7 +577,7 @@ public void testFollowIndexWithNestedField() throws Exception {
577
577
578
578
public void testUnfollowNonExistingIndex () {
579
579
PauseFollowAction .Request unfollowRequest = new PauseFollowAction .Request ("non-existing-index" );
580
- expectThrows (IllegalArgumentException .class ,
580
+ expectThrows (IndexNotFoundException .class ,
581
581
() -> followerClient ().execute (PauseFollowAction .INSTANCE , unfollowRequest ).actionGet ());
582
582
}
583
583
@@ -818,6 +818,27 @@ public void testDeleteFollowerIndex() throws Exception {
818
818
ensureNoCcrTasks ();
819
819
}
820
820
821
+ public void testPauseIndex () throws Exception {
822
+ assertAcked (leaderClient ().admin ().indices ().prepareCreate ("leader" )
823
+ .setSettings (Settings .builder ()
824
+ .put (IndexSettings .INDEX_SOFT_DELETES_SETTING .getKey (), true )
825
+ .put (IndexMetaData .SETTING_NUMBER_OF_SHARDS , 1 )
826
+ .put (IndexMetaData .SETTING_NUMBER_OF_REPLICAS , 0 )
827
+ .build ()));
828
+ followerClient ().execute (PutFollowAction .INSTANCE , putFollow ("leader" , "follower" )).get ();
829
+ assertAcked (followerClient ().admin ().indices ().prepareCreate ("regular-index" ));
830
+ assertAcked (followerClient ().execute (PauseFollowAction .INSTANCE , new PauseFollowAction .Request ("follower" )).actionGet ());
831
+ assertThat (expectThrows (IllegalArgumentException .class , () -> followerClient ().execute (
832
+ PauseFollowAction .INSTANCE , new PauseFollowAction .Request ("follower" )).actionGet ()).getMessage (),
833
+ equalTo ("no shard follow tasks for [follower]" ));
834
+ assertThat (expectThrows (IllegalArgumentException .class , () -> followerClient ().execute (
835
+ PauseFollowAction .INSTANCE , new PauseFollowAction .Request ("regular-index" )).actionGet ()).getMessage (),
836
+ equalTo ("index [regular-index] is not a follower index" ));
837
+ assertThat (expectThrows (IndexNotFoundException .class , () -> followerClient ().execute (
838
+ PauseFollowAction .INSTANCE , new PauseFollowAction .Request ("xyz" )).actionGet ()).getMessage (),
839
+ equalTo ("no such index [xyz]" ));
840
+ }
841
+
821
842
public void testUnfollowIndex () throws Exception {
822
843
String leaderIndexSettings = getIndexSettings (1 , 0 , singletonMap (IndexSettings .INDEX_SOFT_DELETES_SETTING .getKey (), "true" ));
823
844
assertAcked (leaderClient ().admin ().indices ().prepareCreate ("index1" ).setSource (leaderIndexSettings , XContentType .JSON ).get ());
0 commit comments