problem: unit tests failed because of enabled jdk ssl implementation

This commit is contained in:
Igor Artamonov
2021-05-24 22:52:56 -04:00
committed by GitHub
parent 974a6d7d44
commit 8424288de2
3 changed files with 16 additions and 4 deletions

View File

@@ -25,6 +25,9 @@ jobs:
with: with:
java-version: 13 java-version: 13
- name: Install System Libs
run: sudo apt-get install -y openssl libapr1
- name: Check - name: Check
uses: eskatos/gradle-command-action@v1 uses: eskatos/gradle-command-action@v1
with: with:

View File

@@ -71,12 +71,14 @@ dependencies {
implementation "io.netty:netty-common:$nettyVersion" implementation "io.netty:netty-common:$nettyVersion"
implementation "io.netty:netty-handler:$nettyVersion" implementation "io.netty:netty-handler:$nettyVersion"
implementation "io.netty:netty-handler-proxy:$nettyVersion" implementation "io.netty:netty-handler-proxy:$nettyVersion"
implementation "io.netty:netty-resolver:$nettyVersion"
implementation "io.netty:netty-resolver-dns:$nettyVersion"
implementation "io.netty:netty-codec:$nettyVersion" implementation "io.netty:netty-codec:$nettyVersion"
implementation "io.netty:netty-codec-http2:$nettyVersion" implementation "io.netty:netty-codec-http2:$nettyVersion"
implementation "io.netty:netty-codec-http:$nettyVersion" implementation "io.netty:netty-codec-http:$nettyVersion"
implementation "io.netty:netty-buffer:$nettyVersion" implementation "io.netty:netty-buffer:$nettyVersion"
implementation "io.netty:netty-tcnative:2.0.39.Final:linux-x86_64@jar" implementation "io.netty:netty-tcnative:2.0.39.Final"
implementation "io.netty:netty-tcnative-boringssl-static:2.0.39.Final:linux-x86_64@jar" implementation "io.netty:netty-tcnative-boringssl-static:2.0.39.Final"
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8" implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8"
implementation "org.jetbrains.kotlin:kotlin-reflect" implementation "org.jetbrains.kotlin:kotlin-reflect"

View File

@@ -18,6 +18,7 @@ package io.emeraldpay.dshackle
import io.emeraldpay.dshackle.config.AuthConfig import io.emeraldpay.dshackle.config.AuthConfig
import io.netty.handler.ssl.ClientAuth import io.netty.handler.ssl.ClientAuth
import io.netty.handler.ssl.OpenSsl
import io.netty.handler.ssl.OpenSslServerContext import io.netty.handler.ssl.OpenSslServerContext
import io.netty.handler.ssl.SslContext import io.netty.handler.ssl.SslContext
import spock.lang.Specification import spock.lang.Specification
@@ -27,6 +28,13 @@ class TlsSetupSpec extends Specification {
TlsSetup tlsSetup = new TlsSetup(new FileResolver(new File("src/test/resources/tls-local"))) TlsSetup tlsSetup = new TlsSetup(new FileResolver(new File("src/test/resources/tls-local")))
def setup() {
// !!!!!!!!!!!!
// run test on OS with OpenSSL installed
// !!!!!!!!!!!!
OpenSsl.ensureAvailability()
}
def "TLS disabled"() { def "TLS disabled"() {
setup: setup:
def config = new AuthConfig.ServerTlsAuth( def config = new AuthConfig.ServerTlsAuth(
@@ -52,7 +60,7 @@ class TlsSetupSpec extends Specification {
act.server act.server
!act.client !act.client
with((OpenSslServerContext) act) { with((OpenSslServerContext) act) {
act.clientAuth == ClientAuth.NONE clientAuth == ClientAuth.NONE
with((X509CertImpl) keyCertChain[0]) { with((X509CertImpl) keyCertChain[0]) {
getIssuerDN().name == "CN=ca.myhost.dev, OU=Blockchain CA, O=My Company" getIssuerDN().name == "CN=ca.myhost.dev, OU=Blockchain CA, O=My Company"
} }
@@ -75,7 +83,6 @@ class TlsSetupSpec extends Specification {
act.server act.server
!act.client !act.client
// run test on OS with OpenSSL installed
with((OpenSslServerContext) act) { with((OpenSslServerContext) act) {
clientAuth == ClientAuth.REQUIRE clientAuth == ClientAuth.REQUIRE
with((X509CertImpl) keyCertChain[0]) { with((X509CertImpl) keyCertChain[0]) {