[TEST] Add additional logging to test

Attempt to diagnose elastic/x-pack-elasticsearch#3292 if it occurs again.

Original commit: elastic/x-pack-elasticsearch@eb262540f0
This commit is contained in:
Tim Vernum 2018-01-31 18:26:57 +11:00
parent 99081adfbf
commit d0f6d273d0
1 changed files with 3 additions and 1 deletions

View File

@ -5,6 +5,7 @@
*/ */
package org.elasticsearch.xpack.ssl; package org.elasticsearch.xpack.ssl;
import org.apache.logging.log4j.message.ParameterizedMessage;
import org.bouncycastle.asn1.x509.GeneralNames; import org.bouncycastle.asn1.x509.GeneralNames;
import org.bouncycastle.openssl.jcajce.JcaPEMWriter; import org.bouncycastle.openssl.jcajce.JcaPEMWriter;
import org.elasticsearch.ElasticsearchException; import org.elasticsearch.ElasticsearchException;
@ -26,7 +27,6 @@ import javax.net.ssl.SSLHandshakeException;
import javax.net.ssl.SSLSocket; import javax.net.ssl.SSLSocket;
import javax.net.ssl.SSLSocketFactory; import javax.net.ssl.SSLSocketFactory;
import javax.security.auth.x500.X500Principal; import javax.security.auth.x500.X500Principal;
import java.io.BufferedWriter; import java.io.BufferedWriter;
import java.io.IOException; import java.io.IOException;
import java.net.SocketException; import java.net.SocketException;
@ -147,6 +147,8 @@ public class SSLTrustRestrictionsTests extends SecurityIntegTestCase {
try { try {
tryConnect(trustedCert); tryConnect(trustedCert);
} catch (SSLHandshakeException | SocketException ex) { } catch (SSLHandshakeException | SocketException ex) {
logger.warn(new ParameterizedMessage("unexpected handshake failure with certificate [{}] [{}]",
trustedCert.certificate.getSubjectDN(), trustedCert.certificate.getSubjectAlternativeNames()), ex);
fail("handshake should have been successful, but failed with " + ex); fail("handshake should have been successful, but failed with " + ex);
} }
} }