Skip to content

Commit bbc0941

Browse files
authored
RUBY-3267 make specs pass when X.509 authentication is active (#2781)
* RUBY-3267 ignore SDAM unified specs when X.509 auth is enabled This is because the SDAM unified specs set a failpoint for an authentication conversation that is never used with X.509 authentication, and so can not pass with that active. * re-enable the x.509 specs * auth flow here assumes SASL; X.509 mechanism is incompatible
1 parent e7b4a22 commit bbc0941

File tree

5 files changed

+42
-36
lines changed

5 files changed

+42
-36
lines changed

.evergreen/config.yml

Lines changed: 15 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1304,24 +1304,21 @@ buildvariants:
13041304
tasks:
13051305
- name: "test-mlaunch"
13061306

1307-
# The X.509 tests are failing with exceptions being expected, but never
1308-
# raised. (RUBY-3267)
1309-
#
1310-
# - matrix_name: "x509-tests"
1311-
# matrix_spec:
1312-
# auth-and-ssl: "x509"
1313-
# ruby: "ruby-3.2"
1314-
# # needs the latest_5x_mdb because run-tests.sh uses `mongo` to configure
1315-
# # the server for certain auth mechanisms. Once run-tests.sh is made smart
1316-
# # enough to install mongosh, and then use either mongo or mongosh
1317-
# # (depending on server version and what's available), we can bump this to
1318-
# # the latest stable db version.
1319-
# mongodb-version: "5.3"
1320-
# topology: standalone
1321-
# os: rhel8
1322-
# display_name: "${mongodb-version} ${topology} ${auth-and-ssl} ${ruby}"
1323-
# tasks:
1324-
# - name: "test-mlaunch"
1307+
- matrix_name: "x509-tests"
1308+
matrix_spec:
1309+
auth-and-ssl: "x509"
1310+
ruby: "ruby-3.2"
1311+
# needs the latest_5x_mdb because run-tests.sh uses `mongo` to configure
1312+
# the server for certain auth mechanisms. Once run-tests.sh is made smart
1313+
# enough to install mongosh, and then use either mongo or mongosh
1314+
# (depending on server version and what's available), we can bump this to
1315+
# the latest stable db version.
1316+
mongodb-version: "5.3"
1317+
topology: standalone
1318+
os: rhel8
1319+
display_name: "${mongodb-version} ${topology} ${auth-and-ssl} ${ruby}"
1320+
tasks:
1321+
- name: "test-mlaunch"
13251322

13261323
- matrix_name: "jruby-auth"
13271324
matrix_spec:

.evergreen/config/standard.yml.erb

Lines changed: 15 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -232,24 +232,21 @@ buildvariants:
232232
tasks:
233233
- name: "test-mlaunch"
234234

235-
# The X.509 tests are failing with exceptions being expected, but never
236-
# raised. (RUBY-3267)
237-
#
238-
# - matrix_name: "x509-tests"
239-
# matrix_spec:
240-
# auth-and-ssl: "x509"
241-
# ruby: <%= latest_ruby %>
242-
# # needs the latest_5x_mdb because run-tests.sh uses `mongo` to configure
243-
# # the server for certain auth mechanisms. Once run-tests.sh is made smart
244-
# # enough to install mongosh, and then use either mongo or mongosh
245-
# # (depending on server version and what's available), we can bump this to
246-
# # the latest stable db version.
247-
# mongodb-version: <%= latest_5x_mdb %>
248-
# topology: standalone
249-
# os: rhel8
250-
# display_name: "${mongodb-version} ${topology} ${auth-and-ssl} ${ruby}"
251-
# tasks:
252-
# - name: "test-mlaunch"
235+
- matrix_name: "x509-tests"
236+
matrix_spec:
237+
auth-and-ssl: "x509"
238+
ruby: <%= latest_ruby %>
239+
# needs the latest_5x_mdb because run-tests.sh uses `mongo` to configure
240+
# the server for certain auth mechanisms. Once run-tests.sh is made smart
241+
# enough to install mongosh, and then use either mongo or mongosh
242+
# (depending on server version and what's available), we can bump this to
243+
# the latest stable db version.
244+
mongodb-version: <%= latest_5x_mdb %>
245+
topology: standalone
246+
os: rhel8
247+
display_name: "${mongodb-version} ${topology} ${auth-and-ssl} ${ruby}"
248+
tasks:
249+
- name: "test-mlaunch"
253250

254251
- matrix_name: "jruby-auth"
255252
matrix_spec:

spec/mongo/server/connection_spec.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -265,6 +265,10 @@ class ConnectionSpecTestException < Exception; end
265265
context 'when #authenticate! raises an exception' do
266266
require_auth
267267

268+
# because the mock/stub flow here doesn't cover the flow used by
269+
# the X.509 authentication mechanism...
270+
forbid_x509_auth
271+
268272
let(:server_options) do
269273
Mongo::Client.canonicalize_ruby_options(
270274
SpecConfig.instance.all_test_options,

spec/spec_tests/sdam_unified_spec.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,7 @@
99
SDAM_UNIFIED_TESTS = Dir.glob("#{base}/**/*.yml").sort
1010

1111
describe 'SDAM unified spec tests' do
12+
forbid_x509_auth
13+
1214
define_unified_spec_tests(base, SDAM_UNIFIED_TESTS)
1315
end

spec/support/constraints.rb

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,12 @@ def require_local_tls
1717
end
1818
end
1919

20+
def forbid_x509_auth
21+
before(:all) do
22+
skip 'X.509 auth not allowed' if SpecConfig.instance.x509_auth?
23+
end
24+
end
25+
2026
def max_bson_version(version)
2127
required_version = version.split('.').map(&:to_i)
2228
actual_version = bson_version(required_version.length)

0 commit comments

Comments
 (0)