Skip to content

Commit 8ccd79a

Browse files
committed
Fix synonyms IT tests
1 parent 2181360 commit 8ccd79a

File tree

2 files changed

+9
-10
lines changed

2 files changed

+9
-10
lines changed

muted-tests.yml

-6
Original file line numberDiff line numberDiff line change
@@ -441,12 +441,6 @@ tests:
441441
- class: org.elasticsearch.xpack.esql.plugin.DataNodeRequestSenderIT
442442
method: testSearchWhileRelocating
443443
issue: https://github.com/elastic/elasticsearch/issues/127188
444-
- class: org.elasticsearch.synonyms.SynonymsManagementAPIServiceIT
445-
method: testUpdateRuleWithMaxSynonyms
446-
issue: https://github.com/elastic/elasticsearch/issues/127195
447-
- class: org.elasticsearch.synonyms.SynonymsManagementAPIServiceIT
448-
method: testCreateRuleWithMaxSynonyms
449-
issue: https://github.com/elastic/elasticsearch/issues/127203
450444

451445
# Examples:
452446
#

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

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

1010
package org.elasticsearch.synonyms;
1111

12+
import com.carrotsearch.randomizedtesting.annotations.Repeat;
13+
1214
import org.apache.logging.log4j.Logger;
1315
import org.elasticsearch.action.ActionListener;
1416
import 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

Comments
 (0)