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@5550ca4e1e
This commit is contained in:
Jay Modi 2018-01-30 08:21:15 -07:00 committed by GitHub
parent 0f6ca4716b
commit 71788671ad
1 changed files with 6 additions and 6 deletions

View File

@ -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()),