9
9
10
10
package org .elasticsearch .synonyms ;
11
11
12
+ import com .carrotsearch .randomizedtesting .annotations .Repeat ;
13
+
12
14
import org .apache .logging .log4j .Logger ;
13
15
import org .elasticsearch .action .ActionListener ;
14
16
import org .elasticsearch .action .admin .cluster .health .ClusterHealthResponse ;
@@ -127,6 +129,7 @@ public void onFailure(Exception e) {
127
129
latch .await (5 , TimeUnit .SECONDS );
128
130
}
129
131
132
+ @ Repeat (iterations =1000 )
130
133
public void testCreateTooManySynonymsUsingRuleUpdates () throws InterruptedException {
131
134
CountDownLatch latch = new CountDownLatch (1 );
132
135
int rulesToUpdate = randomIntBetween (1 , 10 );
@@ -135,15 +138,15 @@ public void testCreateTooManySynonymsUsingRuleUpdates() throws InterruptedExcept
135
138
synonymsManagementAPIService .putSynonymsSet (
136
139
synonymSetId ,
137
140
randomSynonymsSet (synonymsToCreate ),
138
- randomBoolean () ,
141
+ true ,
139
142
new ActionListener <>() {
140
143
@ Override
141
144
public void onResponse (SynonymsManagementAPIService .SynonymsReloadResult synonymsReloadResult ) {
142
145
// Create as many rules as should fail
143
146
SynonymRule [] rules = randomSynonymsSet (atLeast (rulesToUpdate + 1 ));
144
147
CountDownLatch updatedRulesLatch = new CountDownLatch (rulesToUpdate );
145
148
for (int i = 0 ; i < rulesToUpdate ; i ++) {
146
- synonymsManagementAPIService .putSynonymRule (synonymSetId , rules [i ], true , new ActionListener <>() {
149
+ synonymsManagementAPIService .putSynonymRule (synonymSetId , rules [i ], randomBoolean () , new ActionListener <>() {
147
150
@ Override
148
151
public void onResponse (SynonymsManagementAPIService .SynonymsReloadResult synonymsReloadResult ) {
149
152
updatedRulesLatch .countDown ();
@@ -203,6 +206,7 @@ public void onFailure(Exception e) {
203
206
latch .await (5 , TimeUnit .SECONDS );
204
207
}
205
208
209
+ @ Repeat (iterations =1000 )
206
210
public void testUpdateRuleWithMaxSynonyms () throws InterruptedException {
207
211
CountDownLatch latch = new CountDownLatch (1 );
208
212
String synonymSetId = randomIdentifier ();
@@ -238,16 +242,17 @@ public void onFailure(Exception e) {
238
242
latch .await (5 , TimeUnit .SECONDS );
239
243
}
240
244
245
+ @ Repeat (iterations =1000 )
241
246
public void testCreateRuleWithMaxSynonyms () throws InterruptedException {
242
247
CountDownLatch latch = new CountDownLatch (1 );
243
248
String synonymSetId = randomIdentifier ();
244
249
String ruleId = randomIdentifier ();
245
250
SynonymRule [] synonymsSet = randomSynonymsSet (maxSynonymSets , maxSynonymSets );
246
- synonymsManagementAPIService .putSynonymsSet (synonymSetId , synonymsSet , randomBoolean () , new ActionListener <>() {
251
+ synonymsManagementAPIService .putSynonymsSet (synonymSetId , synonymsSet , true , new ActionListener <>() {
247
252
@ Override
248
253
public void onResponse (SynonymsManagementAPIService .SynonymsReloadResult synonymsReloadResult ) {
249
254
// Updating a rule fails
250
- synonymsManagementAPIService .putSynonymRule (synonymSetId , randomSynonymRule (ruleId ), true , new ActionListener <>() {
255
+ synonymsManagementAPIService .putSynonymRule (synonymSetId , randomSynonymRule (ruleId ), randomBoolean () , new ActionListener <>() {
251
256
@ Override
252
257
public void onResponse (SynonymsManagementAPIService .SynonymsReloadResult synonymsReloadResult ) {
253
258
fail ("Should not create a new rule that does not exist when at max capacity" );
0 commit comments