Skip to content

Commit 37e4a31

Browse files
committed
Fix brittle & down tests
1 parent 1f0b14b commit 37e4a31

File tree

1 file changed

+20
-11
lines changed

1 file changed

+20
-11
lines changed

spec/ssl-test_spec.rb

Lines changed: 20 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
# SSLTest.logger = Logger.new(STDOUT)
77

88
describe SSLTest do
9+
before { SSLTest.flush_cache }
10+
911
describe '.test' do
1012
it "returns no error on valid SNI website" do
1113
valid, error, cert = SSLTest.test("https://www.mycs.com")
@@ -15,20 +17,22 @@
1517
end
1618

1719
it "returns no error on valid SAN" do
18-
pending "Expired for the moment"
19-
valid, error, cert = SSLTest.test("https://1000-sans.badssl.com/")
20+
# CN is updown.io, www.updown.io is an Alternative Name
21+
valid, error, cert = SSLTest.test("https://www.updown.io/")
2022
expect(error).to be_nil
2123
expect(valid).to eq(true)
2224
expect(cert).to be_a OpenSSL::X509::Certificate
2325
end
2426

25-
it "returns no error when no CN" do
26-
pending "Expired for the moment https://github.com/chromium/badssl.com/issues/447"
27-
valid, error, cert = SSLTest.test("https://no-common-name.badssl.com/")
28-
expect(error).to be_nil
29-
expect(valid).to eq(true)
30-
expect(cert).to be_a OpenSSL::X509::Certificate
31-
end
27+
# Disabled: unlikely to be repaired anytime soon: https://github.com/chromium/badssl.com/issues/447
28+
# Couldn't find a good alternative
29+
# it "returns no error when no CN" do
30+
# pending "Expired for the moment https://github.com/chromium/badssl.com/issues/447"
31+
# valid, error, cert = SSLTest.test("https://no-common-name.badssl.com/")
32+
# expect(error).to be_nil
33+
# expect(valid).to eq(true)
34+
# expect(cert).to be_a OpenSSL::X509::Certificate
35+
# end
3236

3337
it "works with websites blocking http requests" do
3438
valid, error, cert = SSLTest.test("https://obyava.ua")
@@ -99,8 +103,8 @@
99103
it "returns error on revoked cert (OCSP)" do
100104
expect(SSLTest).to receive(:follow_ocsp_redirects).once.and_call_original
101105
expect(SSLTest).not_to receive(:follow_crl_redirects)
102-
valid, error, cert = SSLTest.test("https://revoked.badssl.com/")
103-
expect(error).to eq ("SSL certificate revoked: Key Compromise (revocation date: 2025-11-04 21:01:29 UTC)")
106+
valid, error, cert = SSLTest.test("https://revoked-rsa-dv.ssl.com/")
107+
expect(error).to eq ("SSL certificate revoked: The certificate was revoked for an unknown reason (revocation date: 2025-06-09 15:07:39 UTC)")
104108
expect(valid).to eq(false)
105109
expect(cert).to be_a OpenSSL::X509::Certificate
106110
end
@@ -159,6 +163,11 @@
159163
expect(error).to be_nil
160164
expect(valid).to eq(true)
161165
expect(cert).to be_a OpenSSL::X509::Certificate
166+
# make sure both were used
167+
expect(SSLTest.cache_size).to match({
168+
crl: hash_including(lists: 1),
169+
ocsp: hash_including(responses: 1, errors: 0)
170+
})
162171
end
163172

164173
it "accepts tcps scheme" do

0 commit comments

Comments
 (0)