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