Skip to content

Commit a3dca50

Browse files
committed
Checks that timeout is passed correctly to the check health method
1 parent fbe393f commit a3dca50

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

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

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -316,10 +316,13 @@ public void onFailure(Exception e) {
316316

317317
public void testCreateSynonymsWithYellowSynonymsIndex() throws Exception {
318318

319+
TimeValue timeout = randomTimeValue();
320+
319321
// Override health method check to simulate a timeout in checking the synonyms index
320322
synonymsManagementAPIService = new SynonymsManagementAPIService(client()) {
321323
@Override
322-
void checkSynonymsIndexHealth(TimeValue timeout, ActionListener<ClusterHealthResponse> listener) {
324+
void checkSynonymsIndexHealth(TimeValue actualTimeout, ActionListener<ClusterHealthResponse> listener) {
325+
assertEquals(actualTimeout, timeout);
323326
ClusterState clusterState = ClusterState.builder(ClusterName.DEFAULT).build();
324327
ClusterHealthResponse response = new ClusterHealthResponse(
325328
randomIdentifier(),
@@ -334,7 +337,7 @@ void checkSynonymsIndexHealth(TimeValue timeout, ActionListener<ClusterHealthRes
334337
// Create a rule fails
335338
CountDownLatch putLatch = new CountDownLatch(1);
336339
String synonymSetId = randomIdentifier();
337-
synonymsManagementAPIService.putSynonymsSet(synonymSetId, randomSynonymsSet(1, 1), DEFAULT_TIMEOUT, new ActionListener<>() {
340+
synonymsManagementAPIService.putSynonymsSet(synonymSetId, randomSynonymsSet(1, 1), timeout, new ActionListener<>() {
338341
@Override
339342
public void onResponse(SynonymsManagementAPIService.SynonymsReloadResult synonymsReloadResult) {
340343
fail("Shouldn't have been able to create synonyms with a timeout in synonyms index health");
@@ -356,7 +359,7 @@ public void onFailure(Exception e) {
356359
synonymsManagementAPIService.putSynonymRule(
357360
synonymSetId,
358361
randomSynonymRule(randomIdentifier()),
359-
DEFAULT_TIMEOUT,
362+
timeout,
360363
new ActionListener<>() {
361364
@Override
362365
public void onResponse(SynonymsManagementAPIService.SynonymsReloadResult synonymsReloadResult) {

0 commit comments

Comments
 (0)