Ensure latch is counted down when assertion trips (#60800)

The ReloadSecureSettingsIT uses latches to ensure coordination across
requests to the underlying in memory cluster. However, in the case of an
expected failure, if the assertion fails, the latch will never be
counted down, and will cause the test to hang indefinitely. This commit
ensures the latch is always counted down with a try/finally.

relates #51546
This commit is contained in:
Ryan Ernst 2020-08-06 15:33:24 -07:00 committed by Ryan Ernst
parent 98119578a1
commit fc38af363e
No known key found for this signature in database
GPG Key ID: 5F7EA39E15F54DCE
1 changed files with 8 additions and 4 deletions

View File

@ -175,10 +175,14 @@ public class ReloadSecureSettingsIT extends ESIntegTestCase {
@Override
public void onFailure(Exception e) {
assertThat(e, instanceOf(ElasticsearchException.class));
assertThat(e.getMessage(),
containsString("Secure settings cannot be updated cluster wide when TLS for the transport layer is not enabled"));
latch.countDown();
try {
assertThat(e, instanceOf(ElasticsearchException.class));
assertThat(e.getMessage(),
containsString("Secure settings cannot be updated cluster wide when TLS for the " +
"transport layer is not enabled"));
} finally {
latch.countDown();
}
}
});
latch.await();