[rubygems/rubygems] Use OpenSSL constants for error codes.
This fixes the following test error testing against OpenSSL 3.x:
~~~
2) Failure:
TestGemRequest#test_verify_certificate_extra_message [/builddir/build/BUILD/ruby-3.0.2/test/rubygems/test_gem_request.rb:358]:
<"ERROR: SSL verification error at depth 0: invalid CA certificate (24)\n" +
"ERROR: Certificate is an invalid CA certificate\n"> expected but was
<"ERROR: SSL verification error at depth 0: invalid CA certificate (79)\n" +
"ERROR: Certificate is an invalid CA certificate\n">.
~~~
Where the root cause is this OpenSSL commit:
1e41dadfa7
It seems that OpenSSL upstream considers the constant value just an
implementation detail and therefore this changes the test case to
follow the suite.
https://github.com/rubygems/rubygems/commit/8acf8e95dc
This commit is contained in:
parent
83704a2851
commit
c2dcaa7362
@ -354,30 +354,36 @@ class TestGemRequest < Gem::TestCase
|
|||||||
|
|
||||||
def test_verify_certificate
|
def test_verify_certificate
|
||||||
pend if Gem.java_platform?
|
pend if Gem.java_platform?
|
||||||
|
|
||||||
|
error_number = OpenSSL::X509::V_ERR_OUT_OF_MEM
|
||||||
|
|
||||||
store = OpenSSL::X509::Store.new
|
store = OpenSSL::X509::Store.new
|
||||||
context = OpenSSL::X509::StoreContext.new store
|
context = OpenSSL::X509::StoreContext.new store
|
||||||
context.error = OpenSSL::X509::V_ERR_OUT_OF_MEM
|
context.error = error_number
|
||||||
|
|
||||||
use_ui @ui do
|
use_ui @ui do
|
||||||
Gem::Request.verify_certificate context
|
Gem::Request.verify_certificate context
|
||||||
end
|
end
|
||||||
|
|
||||||
assert_equal "ERROR: SSL verification error at depth 0: out of memory (17)\n",
|
assert_equal "ERROR: SSL verification error at depth 0: out of memory (#{error_number})\n",
|
||||||
@ui.error
|
@ui.error
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_verify_certificate_extra_message
|
def test_verify_certificate_extra_message
|
||||||
pend if Gem.java_platform?
|
pend if Gem.java_platform?
|
||||||
|
|
||||||
|
error_number = OpenSSL::X509::V_ERR_INVALID_CA
|
||||||
|
|
||||||
store = OpenSSL::X509::Store.new
|
store = OpenSSL::X509::Store.new
|
||||||
context = OpenSSL::X509::StoreContext.new store
|
context = OpenSSL::X509::StoreContext.new store
|
||||||
context.error = OpenSSL::X509::V_ERR_INVALID_CA
|
context.error = error_number
|
||||||
|
|
||||||
use_ui @ui do
|
use_ui @ui do
|
||||||
Gem::Request.verify_certificate context
|
Gem::Request.verify_certificate context
|
||||||
end
|
end
|
||||||
|
|
||||||
expected = <<-ERROR
|
expected = <<-ERROR
|
||||||
ERROR: SSL verification error at depth 0: invalid CA certificate (24)
|
ERROR: SSL verification error at depth 0: invalid CA certificate (#{error_number})
|
||||||
ERROR: Certificate is an invalid CA certificate
|
ERROR: Certificate is an invalid CA certificate
|
||||||
ERROR
|
ERROR
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user