Skip to content

Commit 9d4a87d

Browse files
committed
RUBY-886 Add test for default cert store
1 parent c325c2f commit 9d4a87d

File tree

2 files changed

+25
-4
lines changed

2 files changed

+25
-4
lines changed

spec/mongo/socket/ssl_spec.rb

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,27 @@
6767
end
6868
end
6969

70+
context 'when a CA certificate is not provided', if: running_ssl? && testing_locally? do
71+
72+
let(:options) do
73+
{
74+
:ssl => true,
75+
:ssl_cert => CLIENT_PEM,
76+
:ssl_key => CLIENT_PEM,
77+
:ssl_verify => true
78+
}
79+
end
80+
81+
before do
82+
ENV['SSL_CERT_FILE']= CA_PEM
83+
socket.connect!
84+
end
85+
86+
it 'uses the default cert store' do
87+
expect(socket).to be_alive
88+
end
89+
end
90+
7091
context 'when ssl_verify is not specified' do
7192

7293
let(:options) do

spec/support/certificates/client.pem

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,13 @@ Certificate:
3232
6e:a7
3333
Exponent: 65537 (0x10001)
3434
X509v3 extensions:
35-
X509v3 Basic Constraints:
35+
X509v3 Basic Constraints:
3636
CA:FALSE
37-
Netscape Comment:
37+
Netscape Comment:
3838
OpenSSL Generated Certificate
39-
X509v3 Subject Key Identifier:
39+
X509v3 Subject Key Identifier:
4040
4A:8B:EE:22:42:E6:F8:62:4C:86:38:8D:C5:78:95:98:C1:10:05:7C
41-
X509v3 Authority Key Identifier:
41+
X509v3 Authority Key Identifier:
4242
keyid:07:41:19:3A:9F:7E:C5:B7:22:4E:B7:BC:D5:DF:E4:FC:09:B8:64:16
4343

4444
Signature Algorithm: sha1WithRSAEncryption

0 commit comments

Comments
 (0)