Skip to content

Commit

Permalink
Fix new race condition in DecommissionControllerTests
Browse files Browse the repository at this point in the history
My previous fix introduced a new race condition by making the assertions
before waiting on the latch.

Signed-off-by: Andrew Ross <andrross@amazon.com>
  • Loading branch information
andrross committed Oct 5, 2022
1 parent e354461 commit 5479f90
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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 {
Expand Down

0 comments on commit 5479f90

Please sign in to comment.