@@ -90,11 +90,6 @@ public void testIndexFollowing() throws Exception {
90
90
}
91
91
92
92
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
-
98
93
String leaderIndex1 = "logs-20200101" ;
99
94
String leaderIndex2 = "logs-20200102" ;
100
95
String leaderIndex3 = "logs-20200103" ;
@@ -134,7 +129,7 @@ public void testAutoFollowing() throws Exception {
134
129
switch (upgradeState ) {
135
130
case NONE :
136
131
putAutoFollowPattern (followerClient (), "test_pattern" , "leader" , "logs-*" );
137
- createIndex ( leaderIndex1 , indexSettings );
132
+ createLeaderIndex ( leaderClient (), leaderIndex1 );
138
133
index (leaderClient (), leaderIndex1 , 64 );
139
134
assertBusy (() -> {
140
135
String followerIndex = "copy-" + leaderIndex1 ;
@@ -152,7 +147,7 @@ public void testAutoFollowing() throws Exception {
152
147
// and if this node get updated then auto follow stats are reset
153
148
{
154
149
int previousNumberOfSuccessfulFollowedIndices = getNumberOfSuccessfulFollowedIndices ();
155
- createIndex ( leaderIndex2 , indexSettings );
150
+ createLeaderIndex ( leaderClient (), leaderIndex2 );
156
151
index (leaderClient (), leaderIndex2 , 64 );
157
152
assertBusy (() -> {
158
153
String followerIndex = "copy-" + leaderIndex2 ;
@@ -177,7 +172,7 @@ public void testAutoFollowing() throws Exception {
177
172
// and if this node get updated then auto follow stats are reset
178
173
{
179
174
int previousNumberOfSuccessfulFollowedIndices = getNumberOfSuccessfulFollowedIndices ();
180
- createIndex ( leaderIndex3 , indexSettings );
175
+ createLeaderIndex ( leaderClient (), leaderIndex3 );
181
176
index (leaderClient (), leaderIndex3 , 64 );
182
177
assertBusy (() -> {
183
178
String followerIndex = "copy-" + leaderIndex3 ;
@@ -236,12 +231,13 @@ public void testCannotFollowLeaderInUpgradedCluster() throws Exception {
236
231
}
237
232
238
233
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 ()
241
235
.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 ());
245
241
}
246
242
247
243
private static void createIndex (RestClient client , String name , Settings settings ) throws IOException {
0 commit comments