Skip SSLEngineTests that depend on KeyManagerFactory when this is not supported by the openssl version.

Motivation:

Some version of openssl dont support the needed APIs to use a KeyManagerFactory. In this case we should skip the tests.

Modifications:

- Use assumeTrue(...) to skip tests that need a KeyManagerFactory and its not supported.

Result:

Tests pass on all openssl versions we support.
This commit is contained in:
Norman Maurer 2017-02-15 14:34:03 +01:00
parent a0d41abfa5
commit 02d5739257
3 changed files with 93 additions and 0 deletions

View File

@ -16,6 +16,7 @@
package io.netty.handler.ssl; package io.netty.handler.ssl;
import org.junit.BeforeClass; import org.junit.BeforeClass;
import org.junit.Test;
import javax.net.ssl.SSLException; import javax.net.ssl.SSLException;
@ -43,6 +44,41 @@ public class JdkOpenSslEngineInteroptTest extends SSLEngineTest {
return SslProvider.OPENSSL; return SslProvider.OPENSSL;
} }
@Override
@Test
public void testMutualAuthInvalidIntermediateCASucceedWithOptionalClientAuth() throws Exception {
assumeTrue(OpenSsl.supportsKeyManagerFactory());
super.testMutualAuthInvalidIntermediateCASucceedWithOptionalClientAuth();
}
@Override
@Test
public void testMutualAuthInvalidIntermediateCAFailWithOptionalClientAuth() throws Exception {
assumeTrue(OpenSsl.supportsKeyManagerFactory());
super.testMutualAuthInvalidIntermediateCAFailWithOptionalClientAuth();
}
@Override
@Test
public void testMutualAuthInvalidIntermediateCAFailWithRequiredClientAuth() throws Exception {
assumeTrue(OpenSsl.supportsKeyManagerFactory());
super.testMutualAuthInvalidIntermediateCAFailWithRequiredClientAuth();
}
@Override
@Test
public void testMutualAuthValidClientCertChainTooLongFailOptionalClientAuth() throws Exception {
assumeTrue(OpenSsl.supportsKeyManagerFactory());
super.testMutualAuthValidClientCertChainTooLongFailOptionalClientAuth();
}
@Override
@Test
public void testMutualAuthValidClientCertChainTooLongFailRequireClientAuth() throws Exception {
assumeTrue(OpenSsl.supportsKeyManagerFactory());
super.testMutualAuthValidClientCertChainTooLongFailRequireClientAuth();
}
@Override @Override
protected void mySetupMutualAuthServerInitSslHandler(SslHandler handler) { protected void mySetupMutualAuthServerInitSslHandler(SslHandler handler) {
ReferenceCountedOpenSslEngine engine = (ReferenceCountedOpenSslEngine) handler.engine(); ReferenceCountedOpenSslEngine engine = (ReferenceCountedOpenSslEngine) handler.engine();

View File

@ -54,6 +54,41 @@ public class OpenSslEngineTest extends SSLEngineTest {
assumeTrue(OpenSsl.isAvailable()); assumeTrue(OpenSsl.isAvailable());
} }
@Override
@Test
public void testMutualAuthInvalidIntermediateCASucceedWithOptionalClientAuth() throws Exception {
assumeTrue(OpenSsl.supportsKeyManagerFactory());
super.testMutualAuthInvalidIntermediateCASucceedWithOptionalClientAuth();
}
@Override
@Test
public void testMutualAuthInvalidIntermediateCAFailWithOptionalClientAuth() throws Exception {
assumeTrue(OpenSsl.supportsKeyManagerFactory());
super.testMutualAuthInvalidIntermediateCAFailWithOptionalClientAuth();
}
@Override
@Test
public void testMutualAuthInvalidIntermediateCAFailWithRequiredClientAuth() throws Exception {
assumeTrue(OpenSsl.supportsKeyManagerFactory());
super.testMutualAuthInvalidIntermediateCAFailWithRequiredClientAuth();
}
@Override
@Test
public void testMutualAuthValidClientCertChainTooLongFailOptionalClientAuth() throws Exception {
assumeTrue(OpenSsl.supportsKeyManagerFactory());
super.testMutualAuthValidClientCertChainTooLongFailOptionalClientAuth();
}
@Override
@Test
public void testMutualAuthValidClientCertChainTooLongFailRequireClientAuth() throws Exception {
assumeTrue(OpenSsl.supportsKeyManagerFactory());
super.testMutualAuthValidClientCertChainTooLongFailRequireClientAuth();
}
@Test @Test
public void testNpn() throws Exception { public void testNpn() throws Exception {
ApplicationProtocolConfig apn = acceptingNegotiator(Protocol.NPN, ApplicationProtocolConfig apn = acceptingNegotiator(Protocol.NPN,

View File

@ -17,6 +17,7 @@ package io.netty.handler.ssl;
import org.junit.BeforeClass; import org.junit.BeforeClass;
import org.junit.Ignore; import org.junit.Ignore;
import org.junit.Test;
import static org.junit.Assume.assumeTrue; import static org.junit.Assume.assumeTrue;
@ -50,4 +51,25 @@ public class OpenSslJdkSslEngineInteroptTest extends SSLEngineTest {
@Override @Override
public void testMutualAuthValidClientCertChainTooLongFailRequireClientAuth() throws Exception { public void testMutualAuthValidClientCertChainTooLongFailRequireClientAuth() throws Exception {
} }
@Override
@Test
public void testMutualAuthInvalidIntermediateCASucceedWithOptionalClientAuth() throws Exception {
assumeTrue(OpenSsl.supportsKeyManagerFactory());
super.testMutualAuthInvalidIntermediateCASucceedWithOptionalClientAuth();
}
@Override
@Test
public void testMutualAuthInvalidIntermediateCAFailWithOptionalClientAuth() throws Exception {
assumeTrue(OpenSsl.supportsKeyManagerFactory());
super.testMutualAuthInvalidIntermediateCAFailWithOptionalClientAuth();
}
@Override
@Test
public void testMutualAuthInvalidIntermediateCAFailWithRequiredClientAuth() throws Exception {
assumeTrue(OpenSsl.supportsKeyManagerFactory());
super.testMutualAuthInvalidIntermediateCAFailWithRequiredClientAuth();
}
} }