Skip to content

RUBY-3267 make specs pass when X.509 authentication is active #2781

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Sep 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 15 additions & 18 deletions .evergreen/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1300,24 +1300,21 @@ buildvariants:
tasks:
- name: "test-mlaunch"

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

- matrix_name: "jruby-auth"
matrix_spec:
Expand Down
33 changes: 15 additions & 18 deletions .evergreen/config/standard.yml.erb
Original file line number Diff line number Diff line change
Expand Up @@ -232,24 +232,21 @@ buildvariants:
tasks:
- name: "test-mlaunch"

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

- matrix_name: "jruby-auth"
matrix_spec:
Expand Down
4 changes: 4 additions & 0 deletions spec/mongo/server/connection_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,10 @@ class ConnectionSpecTestException < Exception; end
context 'when #authenticate! raises an exception' do
require_auth

# because the mock/stub flow here doesn't cover the flow used by
# the X.509 authentication mechanism...
forbid_x509_auth

let(:server_options) do
Mongo::Client.canonicalize_ruby_options(
SpecConfig.instance.all_test_options,
Expand Down
2 changes: 2 additions & 0 deletions spec/spec_tests/sdam_unified_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,7 @@
SDAM_UNIFIED_TESTS = Dir.glob("#{base}/**/*.yml").sort

describe 'SDAM unified spec tests' do
forbid_x509_auth

define_unified_spec_tests(base, SDAM_UNIFIED_TESTS)
end
6 changes: 6 additions & 0 deletions spec/support/constraints.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,12 @@ def require_local_tls
end
end

def forbid_x509_auth
before(:all) do
skip 'X.509 auth not allowed' if SpecConfig.instance.x509_auth?
end
end

def max_bson_version(version)
required_version = version.split('.').map(&:to_i)
actual_version = bson_version(required_version.length)
Expand Down