Skip to content

Commit 616f3c7

Browse files
committed
Remove Repeat annotation as it's forbidden
1 parent e334330 commit 616f3c7

File tree

1 file changed

+117
-115
lines changed

1 file changed

+117
-115
lines changed

server/src/internalClusterTest/java/org/elasticsearch/synonyms/SynonymsManagementAPIServiceIT.java

+117-115
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,6 @@
99

1010
package org.elasticsearch.synonyms;
1111

12-
import com.carrotsearch.randomizedtesting.annotations.Repeat;
13-
1412
import org.apache.logging.log4j.Logger;
1513
import org.elasticsearch.action.ActionListener;
1614
import org.elasticsearch.action.admin.cluster.health.ClusterHealthResponse;
@@ -129,149 +127,153 @@ public void onFailure(Exception e) {
129127
latch.await(5, TimeUnit.SECONDS);
130128
}
131129

132-
@Repeat(iterations=500)
133130
public void testCreateTooManySynonymsUsingRuleUpdates() throws InterruptedException {
134-
CountDownLatch latch = new CountDownLatch(1);
135-
int rulesToUpdate = randomIntBetween(1, 10);
136-
int synonymsToCreate = maxSynonymSets - rulesToUpdate;
137-
String synonymSetId = randomIdentifier();
138-
synonymsManagementAPIService.putSynonymsSet(
139-
synonymSetId,
140-
randomSynonymsSet(synonymsToCreate),
141-
true,
142-
new ActionListener<>() {
143-
@Override
144-
public void onResponse(SynonymsManagementAPIService.SynonymsReloadResult synonymsReloadResult) {
145-
// Create as many rules as should fail
146-
SynonymRule[] rules = randomSynonymsSet(atLeast(rulesToUpdate + 1));
147-
CountDownLatch updatedRulesLatch = new CountDownLatch(rulesToUpdate);
148-
for (int i = 0; i < rulesToUpdate; i++) {
149-
synonymsManagementAPIService.putSynonymRule(synonymSetId, rules[i], randomBoolean(), new ActionListener<>() {
150-
@Override
151-
public void onResponse(SynonymsManagementAPIService.SynonymsReloadResult synonymsReloadResult) {
152-
updatedRulesLatch.countDown();
153-
}
154-
155-
@Override
156-
public void onFailure(Exception e) {
157-
fail(e);
158-
}
159-
});
160-
}
161-
try {
162-
updatedRulesLatch.await(5, TimeUnit.SECONDS);
163-
} catch (InterruptedException e) {
164-
fail(e);
165-
}
166-
167-
// Updating more rules fails
168-
int rulesToInsert = rules.length - rulesToUpdate;
169-
CountDownLatch insertRulesLatch = new CountDownLatch(rulesToInsert);
170-
for (int i = rulesToUpdate; i < rulesToInsert; i++) {
171-
synonymsManagementAPIService.putSynonymRule(
172-
// Error here
173-
synonymSetId,
174-
rules[i],
175-
randomBoolean(),
176-
new ActionListener<>() {
131+
for (int iters = 0; iters < 500; iters++) {
132+
CountDownLatch latch = new CountDownLatch(1);
133+
int rulesToUpdate = randomIntBetween(1, 10);
134+
int synonymsToCreate = maxSynonymSets - rulesToUpdate;
135+
String synonymSetId = randomIdentifier();
136+
synonymsManagementAPIService.putSynonymsSet(
137+
synonymSetId,
138+
randomSynonymsSet(synonymsToCreate),
139+
true,
140+
new ActionListener<>() {
141+
@Override
142+
public void onResponse(SynonymsManagementAPIService.SynonymsReloadResult synonymsReloadResult) {
143+
// Create as many rules as should fail
144+
SynonymRule[] rules = randomSynonymsSet(atLeast(rulesToUpdate + 1));
145+
CountDownLatch updatedRulesLatch = new CountDownLatch(rulesToUpdate);
146+
for (int i = 0; i < rulesToUpdate; i++) {
147+
synonymsManagementAPIService.putSynonymRule(synonymSetId, rules[i], randomBoolean(), new ActionListener<>() {
177148
@Override
178149
public void onResponse(SynonymsManagementAPIService.SynonymsReloadResult synonymsReloadResult) {
179-
fail("Shouldn't have been able to update a rule");
150+
updatedRulesLatch.countDown();
180151
}
181152

182153
@Override
183154
public void onFailure(Exception e) {
184-
if (e instanceof IllegalArgumentException == false) {
185-
fail(e);
155+
fail(e);
156+
}
157+
});
158+
}
159+
try {
160+
updatedRulesLatch.await(5, TimeUnit.SECONDS);
161+
} catch (InterruptedException e) {
162+
fail(e);
163+
}
164+
165+
// Updating more rules fails
166+
int rulesToInsert = rules.length - rulesToUpdate;
167+
CountDownLatch insertRulesLatch = new CountDownLatch(rulesToInsert);
168+
for (int i = rulesToUpdate; i < rulesToInsert; i++) {
169+
synonymsManagementAPIService.putSynonymRule(
170+
// Error here
171+
synonymSetId,
172+
rules[i],
173+
randomBoolean(),
174+
new ActionListener<>() {
175+
@Override
176+
public void onResponse(SynonymsManagementAPIService.SynonymsReloadResult synonymsReloadResult) {
177+
fail("Shouldn't have been able to update a rule");
178+
}
179+
180+
@Override
181+
public void onFailure(Exception e) {
182+
if (e instanceof IllegalArgumentException == false) {
183+
fail(e);
184+
}
185+
updatedRulesLatch.countDown();
186186
}
187-
updatedRulesLatch.countDown();
188187
}
189-
}
190-
);
188+
);
189+
}
190+
try {
191+
insertRulesLatch.await(5, TimeUnit.SECONDS);
192+
} catch (InterruptedException e) {
193+
fail(e);
194+
}
191195
}
192-
try {
193-
insertRulesLatch.await(5, TimeUnit.SECONDS);
194-
} catch (InterruptedException e) {
196+
197+
@Override
198+
public void onFailure(Exception e) {
195199
fail(e);
196200
}
197201
}
202+
);
203+
204+
latch.await(5, TimeUnit.SECONDS);
205+
}
206+
}
207+
208+
public void testUpdateRuleWithMaxSynonyms() throws InterruptedException {
209+
for (int iters = 0; iters < 500; iters++) {
210+
211+
CountDownLatch latch = new CountDownLatch(1);
212+
String synonymSetId = randomIdentifier();
213+
SynonymRule[] synonymsSet = randomSynonymsSet(maxSynonymSets, maxSynonymSets);
214+
synonymsManagementAPIService.putSynonymsSet(synonymSetId, synonymsSet, true, new ActionListener<>() {
215+
@Override
216+
public void onResponse(SynonymsManagementAPIService.SynonymsReloadResult synonymsReloadResult) {
217+
// Updating a rule fails
218+
synonymsManagementAPIService.putSynonymRule(
219+
synonymSetId,
220+
synonymsSet[randomIntBetween(0, maxSynonymSets - 1)],
221+
randomBoolean(),
222+
new ActionListener<>() {
223+
@Override
224+
public void onResponse(SynonymsManagementAPIService.SynonymsReloadResult synonymsReloadResult) {
225+
latch.countDown();
226+
}
227+
228+
@Override
229+
public void onFailure(Exception e) {
230+
fail("Should update a rule that already exists at max capcity");
231+
}
232+
}
233+
);
234+
}
198235

199236
@Override
200237
public void onFailure(Exception e) {
201238
fail(e);
202239
}
203-
}
204-
);
240+
});
205241

206-
latch.await(5, TimeUnit.SECONDS);
242+
latch.await(5, TimeUnit.SECONDS);
243+
}
207244
}
208245

209-
@Repeat(iterations=500)
210-
public void testUpdateRuleWithMaxSynonyms() throws InterruptedException {
211-
CountDownLatch latch = new CountDownLatch(1);
212-
String synonymSetId = randomIdentifier();
213-
SynonymRule[] synonymsSet = randomSynonymsSet(maxSynonymSets, maxSynonymSets);
214-
synonymsManagementAPIService.putSynonymsSet(synonymSetId, synonymsSet, true, new ActionListener<>() {
215-
@Override
216-
public void onResponse(SynonymsManagementAPIService.SynonymsReloadResult synonymsReloadResult) {
217-
// Updating a rule fails
218-
synonymsManagementAPIService.putSynonymRule(
219-
synonymSetId,
220-
synonymsSet[randomIntBetween(0, maxSynonymSets - 1)],
221-
randomBoolean(),
222-
new ActionListener<>() {
246+
public void testCreateRuleWithMaxSynonyms() throws InterruptedException {
247+
for (int iters = 0; iters < 500; iters++) {
248+
CountDownLatch latch = new CountDownLatch(1);
249+
String synonymSetId = randomIdentifier();
250+
String ruleId = randomIdentifier();
251+
SynonymRule[] synonymsSet = randomSynonymsSet(maxSynonymSets, maxSynonymSets);
252+
synonymsManagementAPIService.putSynonymsSet(synonymSetId, synonymsSet, true, new ActionListener<>() {
253+
@Override
254+
public void onResponse(SynonymsManagementAPIService.SynonymsReloadResult synonymsReloadResult) {
255+
// Updating a rule fails
256+
synonymsManagementAPIService.putSynonymRule(synonymSetId, randomSynonymRule(ruleId), randomBoolean(), new ActionListener<>() {
223257
@Override
224258
public void onResponse(SynonymsManagementAPIService.SynonymsReloadResult synonymsReloadResult) {
225-
latch.countDown();
259+
fail("Should not create a new rule that does not exist when at max capacity");
226260
}
227261

228262
@Override
229263
public void onFailure(Exception e) {
230-
fail("Should update a rule that already exists at max capcity");
264+
latch.countDown();
231265
}
232-
}
233-
);
234-
}
235-
236-
@Override
237-
public void onFailure(Exception e) {
238-
fail(e);
239-
}
240-
});
241-
242-
latch.await(5, TimeUnit.SECONDS);
243-
}
244-
245-
@Repeat(iterations=500)
246-
public void testCreateRuleWithMaxSynonyms() throws InterruptedException {
247-
CountDownLatch latch = new CountDownLatch(1);
248-
String synonymSetId = randomIdentifier();
249-
String ruleId = randomIdentifier();
250-
SynonymRule[] synonymsSet = randomSynonymsSet(maxSynonymSets, maxSynonymSets);
251-
synonymsManagementAPIService.putSynonymsSet(synonymSetId, synonymsSet, true, new ActionListener<>() {
252-
@Override
253-
public void onResponse(SynonymsManagementAPIService.SynonymsReloadResult synonymsReloadResult) {
254-
// Updating a rule fails
255-
synonymsManagementAPIService.putSynonymRule(synonymSetId, randomSynonymRule(ruleId), randomBoolean(), new ActionListener<>() {
256-
@Override
257-
public void onResponse(SynonymsManagementAPIService.SynonymsReloadResult synonymsReloadResult) {
258-
fail("Should not create a new rule that does not exist when at max capacity");
259-
}
260-
261-
@Override
262-
public void onFailure(Exception e) {
263-
latch.countDown();
264-
}
265-
});
266-
}
266+
});
267+
}
267268

268-
@Override
269-
public void onFailure(Exception e) {
270-
fail(e);
271-
}
272-
});
269+
@Override
270+
public void onFailure(Exception e) {
271+
fail(e);
272+
}
273+
});
273274

274-
latch.await(5, TimeUnit.SECONDS);
275+
latch.await(5, TimeUnit.SECONDS);
276+
}
275277
}
276278

277279
public void testTooManySynonymsOnIndexTriggersWarning() throws InterruptedException {

0 commit comments

Comments
 (0)