Description
I've been debugging an issue that surfaced when I filed a PR to upgrade JRuby 1.7 to jruby-openssl 0.9.18.
The issue is that when the jruby external tests for x509store are run, there is a stack trace that looks like this:
test_verify(OpenSSL::TestX509Store):
Java::JavaLang::ClassCastException: org.bouncycastle.jce.provider.X509CertificateObject cannot be cast to org.jruby.ext.openssl.X509Cert
org.jruby.ext.openssl.X509StoreContext.initialize(X509StoreContext.java:132)
org.jruby.ext.openssl.X509StoreContext.newStoreContext(X509StoreContext.java:102)
org.jruby.ext.openssl.X509Store.verify(X509Store.java:225)
org.jruby.ext.openssl.X509Store$INVOKER$i$0$0$verify.call(X509Store$INVOKER$i$0$0$verify.gen)
org.jruby.internal.runtime.methods.DynamicMethod.call(DynamicMethod.java:218)
After some investigation I discovered that there is a test that looks very similar included directly in the jruby-openssl
repo:
https://github.com/jruby/jruby-openssl/blob/master/src/test/ossl/1.9/test_x509store.rb#L36
If I check out the 0.9.18 tag of jruby-openssl
, and run this test locally by setting up JRuby 1.7.26 as my local jruby and running:
jruby -Ilib:. src/test/ossl/1.9/test_x509store.rb
I get the same error. Examining the travis.yml
file, and doing some local experimenting with the various rake tasks for running tests, it appears that this test is never being run by CI.
I can debug the failure itself and with any luck maybe file a PR to fix it, but I don't know how to go about modifying the code so that the test would be run in CI. It seems like, if these tests are useful, they should be run in CI?
I'm also trying to figure out why this hasn't shown up in JRuby9k, which appears to have already been upgraded to jruby-openssl
0.9.18. If I clone a fresh copy of the jruby repo and run from the HEAD of the master branch:
$ mvn -P bootstrap
...
$ export PATH=./bin:$PATH
$ jruby --version
jruby 9.1.7.0-SNAPSHOT (2.3.1) 2016-11-21 89759e4 OpenJDK 64-Bit Server VM 25.111-b14 on 1.8.0_111-8u111-b14-2ubuntu0.16.04.2-b14 +jit [linux-x86_64]
$ jruby -r ./test/mri_test_env.rb test/mri/runner.rb test/mri/openssl/test_x509store.rb
I'm able to reproduce basically the same error:
# Running tests:
[3/3] OpenSSL::TestX509Store#test_verify = 0.18 s
1) Error:
OpenSSL::TestX509Store#test_verify:
Java::JavaLang::ClassCastException: org.bouncycastle.jce.provider.X509CertificateObject cannot be cast to org.jruby.ext.openssl.X509Cert
org.jruby.ext.openssl.X509StoreContext.initialize(X509StoreContext.java:132)
org.jruby.ext.openssl.X509StoreContext.newStoreContext(X509StoreContext.java:102)
org.jruby.ext.openssl.X509Store.verify(X509Store.java:225)
org.jruby.ext.openssl.X509Store$INVOKER$i$0$0$verify.call(X509Store$INVOKER$i$0$0$verify.gen)
org.jruby.internal.runtime.methods.DynamicMethod.call(DynamicMethod.java:212)
It seems unlikely that these tests wouldn't be getting run in CI for JRuby9k, so maybe I'm messing something up in my local environment?