99
1010package org .elasticsearch .synonyms ;
1111
12+ import com .carrotsearch .randomizedtesting .annotations .Repeat ;
13+
1214import org .apache .logging .log4j .Logger ;
1315import org .elasticsearch .action .ActionListener ;
1416import org .elasticsearch .action .admin .cluster .health .ClusterHealthResponse ;
@@ -127,6 +129,7 @@ public void onFailure(Exception e) {
127129 latch .await (5 , TimeUnit .SECONDS );
128130 }
129131
132+ @ Repeat (iterations =1000 )
130133 public void testCreateTooManySynonymsUsingRuleUpdates () throws InterruptedException {
131134 CountDownLatch latch = new CountDownLatch (1 );
132135 int rulesToUpdate = randomIntBetween (1 , 10 );
@@ -135,15 +138,15 @@ public void testCreateTooManySynonymsUsingRuleUpdates() throws InterruptedExcept
135138 synonymsManagementAPIService .putSynonymsSet (
136139 synonymSetId ,
137140 randomSynonymsSet (synonymsToCreate ),
138- randomBoolean () ,
141+ true ,
139142 new ActionListener <>() {
140143 @ Override
141144 public void onResponse (SynonymsManagementAPIService .SynonymsReloadResult synonymsReloadResult ) {
142145 // Create as many rules as should fail
143146 SynonymRule [] rules = randomSynonymsSet (atLeast (rulesToUpdate + 1 ));
144147 CountDownLatch updatedRulesLatch = new CountDownLatch (rulesToUpdate );
145148 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 <>() {
147150 @ Override
148151 public void onResponse (SynonymsManagementAPIService .SynonymsReloadResult synonymsReloadResult ) {
149152 updatedRulesLatch .countDown ();
@@ -203,6 +206,7 @@ public void onFailure(Exception e) {
203206 latch .await (5 , TimeUnit .SECONDS );
204207 }
205208
209+ @ Repeat (iterations =1000 )
206210 public void testUpdateRuleWithMaxSynonyms () throws InterruptedException {
207211 CountDownLatch latch = new CountDownLatch (1 );
208212 String synonymSetId = randomIdentifier ();
@@ -238,16 +242,17 @@ public void onFailure(Exception e) {
238242 latch .await (5 , TimeUnit .SECONDS );
239243 }
240244
245+ @ Repeat (iterations =1000 )
241246 public void testCreateRuleWithMaxSynonyms () throws InterruptedException {
242247 CountDownLatch latch = new CountDownLatch (1 );
243248 String synonymSetId = randomIdentifier ();
244249 String ruleId = randomIdentifier ();
245250 SynonymRule [] synonymsSet = randomSynonymsSet (maxSynonymSets , maxSynonymSets );
246- synonymsManagementAPIService .putSynonymsSet (synonymSetId , synonymsSet , randomBoolean () , new ActionListener <>() {
251+ synonymsManagementAPIService .putSynonymsSet (synonymSetId , synonymsSet , true , new ActionListener <>() {
247252 @ Override
248253 public void onResponse (SynonymsManagementAPIService .SynonymsReloadResult synonymsReloadResult ) {
249254 // Updating a rule fails
250- synonymsManagementAPIService .putSynonymRule (synonymSetId , randomSynonymRule (ruleId ), true , new ActionListener <>() {
255+ synonymsManagementAPIService .putSynonymRule (synonymSetId , randomSynonymRule (ruleId ), randomBoolean () , new ActionListener <>() {
251256 @ Override
252257 public void onResponse (SynonymsManagementAPIService .SynonymsReloadResult synonymsReloadResult ) {
253258 fail ("Should not create a new rule that does not exist when at max capacity" );
0 commit comments