@@ -90,11 +90,6 @@ public void testIndexFollowing() throws Exception {
9090 }
9191
9292 public void testAutoFollowing () throws Exception {
93- final Settings indexSettings = Settings .builder ()
94- .put ("index.soft_deletes.enabled" , true )
95- .put ("index.number_of_shards" , 1 )
96- .build ();
97-
9893 String leaderIndex1 = "logs-20200101" ;
9994 String leaderIndex2 = "logs-20200102" ;
10095 String leaderIndex3 = "logs-20200103" ;
@@ -134,7 +129,7 @@ public void testAutoFollowing() throws Exception {
134129 switch (upgradeState ) {
135130 case NONE :
136131 putAutoFollowPattern (followerClient (), "test_pattern" , "leader" , "logs-*" );
137- createIndex ( leaderIndex1 , indexSettings );
132+ createLeaderIndex ( leaderClient (), leaderIndex1 );
138133 index (leaderClient (), leaderIndex1 , 64 );
139134 assertBusy (() -> {
140135 String followerIndex = "copy-" + leaderIndex1 ;
@@ -152,7 +147,7 @@ public void testAutoFollowing() throws Exception {
152147 // and if this node get updated then auto follow stats are reset
153148 {
154149 int previousNumberOfSuccessfulFollowedIndices = getNumberOfSuccessfulFollowedIndices ();
155- createIndex ( leaderIndex2 , indexSettings );
150+ createLeaderIndex ( leaderClient (), leaderIndex2 );
156151 index (leaderClient (), leaderIndex2 , 64 );
157152 assertBusy (() -> {
158153 String followerIndex = "copy-" + leaderIndex2 ;
@@ -177,7 +172,7 @@ public void testAutoFollowing() throws Exception {
177172 // and if this node get updated then auto follow stats are reset
178173 {
179174 int previousNumberOfSuccessfulFollowedIndices = getNumberOfSuccessfulFollowedIndices ();
180- createIndex ( leaderIndex3 , indexSettings );
175+ createLeaderIndex ( leaderClient (), leaderIndex3 );
181176 index (leaderClient (), leaderIndex3 , 64 );
182177 assertBusy (() -> {
183178 String followerIndex = "copy-" + leaderIndex3 ;
@@ -236,12 +231,13 @@ public void testCannotFollowLeaderInUpgradedCluster() throws Exception {
236231 }
237232
238233 private static void createLeaderIndex (RestClient client , String indexName ) throws IOException {
239- Settings indexSettings = Settings .builder ()
240- .put ("index.soft_deletes.enabled" , true )
234+ Settings .Builder indexSettings = Settings .builder ()
241235 .put ("index.number_of_shards" , 1 )
242- .put ("index.number_of_replicas" , 0 )
243- .build ();
244- createIndex (client , indexName , indexSettings );
236+ .put ("index.number_of_replicas" , 0 );
237+ if (randomBoolean ()) {
238+ indexSettings .put ("index.soft_deletes.enabled" , true );
239+ }
240+ createIndex (client , indexName , indexSettings .build ());
245241 }
246242
247243 private static void createIndex (RestClient client , String name , Settings settings ) throws IOException {
0 commit comments