diff --git a/CHANGELOG.md b/CHANGELOG.md index 868ce6ed7bf9e..a9efbaed8a671 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -118,6 +118,7 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) - [Bug]: Alias filter lost after rollover ([#4499](https://github.com/opensearch-project/OpenSearch/pull/4499)) - Attempt to fix Github workflow for Gradle Check job ([#4679](https://github.com/opensearch-project/OpenSearch/pull/4679)) - Fix flaky DecommissionControllerTests.testTimesOut ([4683](https://github.com/opensearch-project/OpenSearch/pull/4683)) +- Fix new race condition in DecommissionControllerTests ([4688](https://github.com/opensearch-project/OpenSearch/pull/4688)) ### Security diff --git a/server/src/test/java/org/opensearch/cluster/decommission/DecommissionControllerTests.java b/server/src/test/java/org/opensearch/cluster/decommission/DecommissionControllerTests.java index 5b2dce277189c..06f2de04907d6 100644 --- a/server/src/test/java/org/opensearch/cluster/decommission/DecommissionControllerTests.java +++ b/server/src/test/java/org/opensearch/cluster/decommission/DecommissionControllerTests.java @@ -223,7 +223,9 @@ public void testTimesOut() throws InterruptedException { TimeValue.timeValueMillis(0), new ActionListener<>() { @Override - public void onResponse(Void unused) {} + public void onResponse(Void unused) { + countDownLatch.countDown(); + } @Override public void onFailure(Exception e) { @@ -232,10 +234,10 @@ public void onFailure(Exception e) { } } ); + assertTrue(countDownLatch.await(30, TimeUnit.SECONDS)); MatcherAssert.assertThat("Expected onFailure to be called", exceptionReference.get(), notNullValue()); MatcherAssert.assertThat(exceptionReference.get(), instanceOf(OpenSearchTimeoutException.class)); MatcherAssert.assertThat(exceptionReference.get().getMessage(), containsString("waiting for removal of decommissioned nodes")); - assertTrue(countDownLatch.await(30, TimeUnit.SECONDS)); } public void testSuccessfulDecommissionStatusMetadataUpdate() throws InterruptedException {