Skip to content

Commit

Permalink
I just want to know what's going on. Really.
Browse files Browse the repository at this point in the history
  • Loading branch information
carlosdelest committed Jun 7, 2024
1 parent 2eac8ab commit 53b1213
Showing 1 changed file with 22 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public void setUp() throws Exception {
synonymsManagementAPIService = new SynonymsManagementAPIService(client());
}

public void testCreateManySynonyms() throws InterruptedException {
public void testCreateManySynonyms() throws Exception {
CountDownLatch putLatch = new CountDownLatch(1);
String synonymSetId = randomIdentifier();
int rulesNumber = randomIntBetween(
Expand All @@ -64,27 +64,29 @@ public void onFailure(Exception e) {

CountDownLatch getLatch = new CountDownLatch(1);
// Also retrieve them
synonymsManagementAPIService.getSynonymSetRules(
synonymSetId,
0,
SynonymsManagementAPIService.MAX_SYNONYMS_SETS,
new ActionListener<>() {
@Override
public void onResponse(PagedResult<SynonymRule> synonymRulePagedResult) {
// TODO This fails in CI but passes locally. Why?
// assertEquals(rulesNumber, synonymRulePagedResult.totalResults());
// assertEquals(rulesNumber, synonymRulePagedResult.pageResults().length);
getLatch.countDown();
}
assertBusy(() -> {
synonymsManagementAPIService.getSynonymSetRules(
synonymSetId,
0,
SynonymsManagementAPIService.MAX_SYNONYMS_SETS,
new ActionListener<>() {
@Override
public void onResponse(PagedResult<SynonymRule> synonymRulePagedResult) {
// TODO This fails in CI but passes locally. Why?
assertEquals(rulesNumber, synonymRulePagedResult.totalResults());
assertEquals(rulesNumber, synonymRulePagedResult.pageResults().length);
getLatch.countDown();
}

@Override
public void onFailure(Exception e) {
fail(e);
@Override
public void onFailure(Exception e) {
fail(e);
}
}
}
);
);
}, 5, TimeUnit.SECONDS);

getLatch.await(5, TimeUnit.SECONDS);
getLatch.await(10, TimeUnit.SECONDS);
}

public void testCreateTooManySynonymsAtOnce() throws InterruptedException {
Expand Down Expand Up @@ -132,7 +134,7 @@ public void onResponse(SynonymsManagementAPIService.SynonymsReloadResult synonym

@Override
public void onFailure(Exception e) {
fail("Shouldn't have failed to update a rule");
fail(e);
}
});
}
Expand Down

0 comments on commit 53b1213

Please sign in to comment.