From 71788671adb9edb4e67ebdecc325a6e0bb9821dd Mon Sep 17 00:00:00 2001 From: Jay Modi Date: Tue, 30 Jan 2018 08:21:15 -0700 Subject: [PATCH] Test: fix skip check for EllipticCurveSSLTests (elastic/x-pack-elasticsearch#3771) This change fixes the skip check for the EllipticCurveSSLTests. The skip check that is in the test was added to proctect against failures on JVMs that do not support EC ciphers such as the packaged openjdk in some linux distributions. The old skip check did not execute until the cluster was up so the test would still fail with errors such as no cipher suites in common. This change moves the check into a before class method that checks availability. Original commit: elastic/x-pack-elasticsearch@5550ca4e1e9b361b1b1300df2227ae0f3083b584 --- .../transport/ssl/EllipticCurveSSLTests.java | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/plugin/security/src/test/java/org/elasticsearch/xpack/security/transport/ssl/EllipticCurveSSLTests.java b/plugin/security/src/test/java/org/elasticsearch/xpack/security/transport/ssl/EllipticCurveSSLTests.java index ef718d090f7..2fa376ec854 100644 --- a/plugin/security/src/test/java/org/elasticsearch/xpack/security/transport/ssl/EllipticCurveSSLTests.java +++ b/plugin/security/src/test/java/org/elasticsearch/xpack/security/transport/ssl/EllipticCurveSSLTests.java @@ -11,8 +11,7 @@ import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.transport.TransportAddress; import org.elasticsearch.test.SecurityIntegTestCase; import org.elasticsearch.xpack.core.ssl.CertUtils; -import org.elasticsearch.xpack.core.ssl.SSLService; -import org.junit.Before; +import org.junit.BeforeClass; import javax.net.ssl.HandshakeCompletedEvent; import javax.net.ssl.SSLContext; @@ -111,10 +110,11 @@ public class EllipticCurveSSLTests extends SecurityIntegTestCase { } } - @Before - public void assumeECDSACiphersSupported() { - final SSLService sslService = internalCluster().getInstance(SSLService.class); - SSLEngine sslEngine = sslService.createSSLEngine(Settings.EMPTY, Settings.EMPTY); + @BeforeClass + public static void assumeECDSACiphersSupported() throws Exception { + SSLContext sslContext = SSLContext.getInstance("TLSv1.2"); + sslContext.init(null, null, null); + SSLEngine sslEngine = sslContext.createSSLEngine(); assumeTrue("ECDSA ciphers must be supported for this test to run. Enabled ciphers: " + Arrays.toString(sslEngine.getEnabledCipherSuites()) + ", supported ciphers: " + Arrays.toString(sslEngine.getSupportedCipherSuites()),