mirror of
https://github.com/honeymoose/OpenSearch.git
synced 2025-02-17 10:25:15 +00:00
Unwrap transport exception when using transport client (#60801)
The ReloadSecureSettingsIT makes requests to the reload settings apis. In 7.x, the client used from the integ test infrastructure may be a transport client. In that case, the expected exception type, and causes the test to fail (though it will hang indefinitely due to not counting down the latch, see https://github.com/elastic/elasticsearch/pull/60800). This commit adds unwrapping of the remote exception to get the underlying expected exception. closes #51546
This commit is contained in:
parent
c73ab0b16f
commit
9cb45dafab
@ -32,6 +32,7 @@ import org.elasticsearch.plugins.Plugin;
|
||||
import org.elasticsearch.plugins.PluginsService;
|
||||
import org.elasticsearch.plugins.ReloadablePlugin;
|
||||
import org.elasticsearch.test.ESIntegTestCase;
|
||||
import org.elasticsearch.transport.RemoteTransportException;
|
||||
|
||||
import java.io.InputStream;
|
||||
import java.nio.file.Files;
|
||||
@ -45,11 +46,11 @@ import java.util.Map;
|
||||
import java.util.concurrent.CountDownLatch;
|
||||
import java.util.concurrent.atomic.AtomicReference;
|
||||
|
||||
import static org.hamcrest.Matchers.containsString;
|
||||
import static org.hamcrest.Matchers.equalTo;
|
||||
import static org.hamcrest.Matchers.instanceOf;
|
||||
import static org.hamcrest.Matchers.notNullValue;
|
||||
import static org.hamcrest.Matchers.nullValue;
|
||||
import static org.hamcrest.Matchers.instanceOf;
|
||||
import static org.hamcrest.Matchers.containsString;
|
||||
|
||||
@ESIntegTestCase.ClusterScope(minNumDataNodes = 2)
|
||||
public class ReloadSecureSettingsIT extends ESIntegTestCase {
|
||||
@ -149,7 +150,6 @@ public class ReloadSecureSettingsIT extends ESIntegTestCase {
|
||||
assertThat(mockReloadablePlugin.getReloadCount(), equalTo(initialReloadCount));
|
||||
}
|
||||
|
||||
@AwaitsFix(bugUrl = "https://github.com/elastic/elasticsearch/issues/51546")
|
||||
public void testReloadAllNodesWithPasswordWithoutTLSFails() throws Exception {
|
||||
final PluginsService pluginsService = internalCluster().getInstance(PluginsService.class);
|
||||
final MockReloadablePlugin mockReloadablePlugin = pluginsService.filterPlugins(MockReloadablePlugin.class)
|
||||
@ -176,6 +176,11 @@ public class ReloadSecureSettingsIT extends ESIntegTestCase {
|
||||
@Override
|
||||
public void onFailure(Exception e) {
|
||||
try {
|
||||
if (e instanceof RemoteTransportException) {
|
||||
// transport client was used, so need to unwrap the returned exception
|
||||
assertThat(e.getCause(), instanceOf(Exception.class));
|
||||
e = (Exception) e.getCause();
|
||||
}
|
||||
assertThat(e, instanceOf(ElasticsearchException.class));
|
||||
assertThat(e.getMessage(),
|
||||
containsString("Secure settings cannot be updated cluster wide when TLS for the " +
|
||||
|
Loading…
x
Reference in New Issue
Block a user