Skip to content

Commit

Permalink
Merge branch 'master' into 1934-mocking-dns
Browse files Browse the repository at this point in the history
  • Loading branch information
jamis committed Nov 4, 2024
2 parents 3179733 + 45bfc81 commit 49a90e5
Show file tree
Hide file tree
Showing 31 changed files with 389 additions and 173 deletions.
135 changes: 64 additions & 71 deletions .evergreen/config.yml

Large diffs are not rendered by default.

13 changes: 8 additions & 5 deletions .evergreen/config/axes.yml.erb
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,6 @@ axes:
display_name: "6.0"
variables:
MONGODB_VERSION: "6.0"
- id: "5.3"
display_name: "5.3"
variables:
MONGODB_VERSION: "5.3"
CRYPT_SHARED_VERSION: "6.0.5"
- id: "5.0"
display_name: "5.0"
variables:
Expand Down Expand Up @@ -150,6 +145,14 @@ axes:
- id: "ruby"
display_name: Ruby Version
values:
- id: "ruby-3.4"
display_name: ruby-3.4
variables:
RVM_RUBY: "ruby-3.4"
- id: "ruby-3.3"
display_name: ruby-3.3
variables:
RVM_RUBY: "ruby-3.3"
- id: "ruby-3.2"
display_name: ruby-3.2
variables:
Expand Down
6 changes: 3 additions & 3 deletions .evergreen/config/common.yml.erb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ pre_error_fails_task: true
command_type: system

# Protect ourself against rogue test case, or curl gone wild, that runs forever.
exec_timeout_secs: 3600
exec_timeout_secs: 5400

# What to do when evergreen hits the timeout (`post:` tasks are run automatically)
timeout:
Expand Down Expand Up @@ -343,7 +343,7 @@ functions:
"upload test results":
- command: attach.xunit_results
params:
file: ./src/tmp/rspec.xml
file: ./src/rspec.xml

"delete private environment":
- command: shell.exec
Expand Down Expand Up @@ -479,7 +479,7 @@ post:
# Removed, causing timeouts
# - func: "upload working dir"
- func: "upload mo artifacts"
#- func: "upload test results"
# - func: "upload test results"
- func: "upload test results to s3"

task_groups:
Expand Down
37 changes: 13 additions & 24 deletions .evergreen/config/standard.yml.erb
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@

# latest_ruby = the most recently released, stable version of Ruby
# (make sure this version is being built by 10gen/mongo-ruby-toolchain)
latest_ruby = "ruby-3.2".inspect # so it gets quoted as a string
latest_ruby = "ruby-3.3".inspect # so it gets quoted as a string

# these are used for testing against a few recent ruby versions
recent_rubies = %w( ruby-3.2 ruby-3.1 jruby-9.4 )
recent_rubies = %w( ruby-3.3 ruby-3.2 jruby-9.4 )

# this is a list of the most most recent 3.x and 2.x MRI ruby versions
sample_mri_rubies = %w( ruby-3.2 ruby-2.7 )
sample_mri_rubies = %w( ruby-3.3 ruby-2.7 )

# as above, but including the most recent JRuby release
sample_rubies = sample_mri_rubies + %w( jruby-9.4 )
Expand All @@ -20,9 +20,9 @@
# all supported JRuby versions provided by 10gen/mongo-ruby-toolchain
jrubies = %w( jruby-9.4 jruby-9.3 )

supported_mri_rubies_3 = %w( ruby-3.2 ruby-3.1 ruby-3.0 )
supported_mri_rubies_3 = %w( ruby-3.3 ruby-3.2 ruby-3.1 ruby-3.0 )

supported_mri_rubies_3_ubuntu = %w( ruby-3.2 ruby-3.1 )
supported_mri_rubies_3_ubuntu = %w( ruby-3.3 ruby-3.2 ruby-3.1 )

supported_mri_ruby_2 = "ruby-2.7".inspect

Expand All @@ -37,9 +37,8 @@
actual_and_upcoming_mdb = %w( latest 8.0 7.0 )

recent_mdb = %w( 8.0 7.0 )
latest_5x_mdb = "5.3".inspect # so it gets quoted as a string

all_dbs = %w(latest 8.0 7.0 6.0 5.3 5.0 4.4 4.2 4.0 3.6)
all_dbs = %w(latest 8.0 7.0 6.0 5.0 4.4 4.2 4.0 3.6)
%>

buildvariants:
Expand Down Expand Up @@ -87,7 +86,7 @@ buildvariants:
- matrix_name: "mongo-5.x"
matrix_spec:
ruby: <%= recent_rubies %>
mongodb-version: ['5.3']
mongodb-version: ['5.0']
topology: <%= topologies %>
os: ubuntu1804
display_name: "${mongodb-version} ${topology} ${auth-and-ssl} ${ruby}"
Expand Down Expand Up @@ -248,15 +247,10 @@ buildvariants:
- matrix_name: "x509-tests"
matrix_spec:
auth-and-ssl: "x509"
ruby: 'ruby-3.1'
# 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 %>
ruby: <%= latest_ruby %>
mongodb-version: <%= latest_stable_mdb %>
topology: standalone
os: ubuntu1804
os: ubuntu2204
display_name: "${mongodb-version} ${topology} ${auth-and-ssl} ${ruby}"
tasks:
- name: "test-mlaunch"
Expand Down Expand Up @@ -390,13 +384,8 @@ buildvariants:
auth-and-ssl: [ aws-regular, aws-assume-role, aws-ecs, aws-web-identity ]
ruby: <%= latest_ruby %>
topology: standalone
# 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 %>
os: ubuntu1804
mongodb-version: <%= latest_stable_mdb %>
os: ubuntu2204
display_name: "AWS ${auth-and-ssl} ${mongodb-version} ${ruby}"
tasks:
- name: "test-aws-auth"
Expand Down Expand Up @@ -542,7 +531,7 @@ buildvariants:

- matrix_name: "aws-lambda"
matrix_spec:
ruby: <%= latest_ruby %>
ruby: 'ruby-3.2'
os: ubuntu2204
display_name: "AWS Lambda"
tasks:
Expand Down
4 changes: 2 additions & 2 deletions .evergreen/functions-kerberos.sh
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,8 @@ configure_local_kerberos() {
EOT
`"

"$BINDIR"/mongo --eval "$create_user_cmd"
"$BINDIR"/mongo --eval 'db.getSiblingDB("kerberos").test.insert({kerberos: true, authenticated: "yeah"})'
"$BINDIR"/mongosh --eval "$create_user_cmd"
"$BINDIR"/mongosh --eval 'db.getSiblingDB("kerberos").test.insert({kerberos: true, authenticated: "yeah"})'
pkill mongod
sleep 1

Expand Down
2 changes: 1 addition & 1 deletion .evergreen/run-tests-kerberos-integration.sh
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ configure_kerberos_ip_addr
# To test authentication using the mongo shell, note that the host name
# must be uppercased when it is used in the username.
# The following call works when using the docker image:
# /opt/mongodb/bin/mongo --host $SASL_HOST --authenticationMechanism=GSSAPI \
# /opt/mongodb/bin/mongosh --host $SASL_HOST --authenticationMechanism=GSSAPI \
# --authenticationDatabase='$external' --username $SASL_USER@`echo $SASL_HOST |tr a-z A-Z`

echo "Install dependencies"
Expand Down
17 changes: 11 additions & 6 deletions .evergreen/run-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ else
set -x
fi

if test -z "$PROJECT_DIRECTORY"; then
PROJECT_DIRECTORY=`realpath $(dirname $0)/..`
fi

MRSS_ROOT=`dirname "$0"`/../spec/shared

. $MRSS_ROOT/shlib/distro.sh
Expand All @@ -41,7 +45,7 @@ set_env_vars
set_env_python
set_env_ruby

prepare_server $arch
prepare_server

if test "$DOCKER_PRELOAD" != 1; then
install_mlaunch_venv
Expand Down Expand Up @@ -118,7 +122,7 @@ elif test "$AUTH" = x509; then
EOT
`"

"$BINDIR"/mongo --tls \
"$BINDIR"/mongosh --tls \
--tlsCAFile spec/support/certificates/ca.crt \
--tlsCertificateKeyFile spec/support/certificates/client-x509.pem \
-u bootstrap -p bootstrap \
Expand Down Expand Up @@ -286,7 +290,7 @@ fi
export MONGODB_URI="mongodb://$hosts/?serverSelectionTimeoutMS=30000$uri_options"

if echo "$AUTH" |grep -q ^aws-assume-role; then
$BINDIR/mongo "$MONGODB_URI" --eval 'db.runCommand({serverStatus: 1})' |wc
$BINDIR/mongosh "$MONGODB_URI" --eval 'db.runCommand({serverStatus: 1})' | wc
fi

set_fcv
Expand Down Expand Up @@ -353,6 +357,7 @@ elif test "$SOLO" = 1; then
fi
done
else
export JRUBY_OPTS=-J-Xmx2g
bundle exec rake spec:ci
fi

Expand All @@ -364,18 +369,18 @@ if test -f tmp/rspec-all.json; then
mv tmp/rspec-all.json tmp/rspec.json
fi

kill_jruby
kill_jruby || true

if test -n "$OCSP_MOCK_PID"; then
kill "$OCSP_MOCK_PID"
fi

python3 -m mtools.mlaunch.mlaunch stop --dir "$dbdir"
python3 -m mtools.mlaunch.mlaunch stop --dir "$dbdir" || true

if test -n "$FLE" && test "$DOCKER_PRELOAD" != 1; then
# Terminate all kmip servers... and whatever else happens to be running
# that is a python script.
pkill python3
pkill python3 || true
fi

exit ${test_status}
16 changes: 8 additions & 8 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,33 +16,33 @@ jobs:
fail-fast: false
matrix:
os: [ ubuntu-20.04 ]
ruby: ["2.7", "3.0", "3.1", "3.2"]
mongodb: ["3.6", "4.4", "5.0", "6.0", "7.0"]
ruby: ["2.7", "3.0", "3.1", "3.2", "3.3"]
mongodb: ["4.4", "5.0", "6.0", "7.0", "8.0"]
topology: [replica_set, sharded_cluster]
include:
- os: macos
ruby: "2.7"
mongodb: "5.0"
mongodb: "7.0"
topology: server
- os: macos
ruby: "3.0"
mongodb: "5.0"
mongodb: "7.0"
topology: server
- os: ubuntu-latest
ruby: "2.7"
mongodb: "5.0"
mongodb: "7.0"
topology: server
- os: ubuntu-latest
ruby: "3.1"
mongodb: "5.0"
mongodb: "7.0"
topology: server
- os: ubuntu-latest
ruby: "3.2"
mongodb: "5.0"
mongodb: "7.0"
topology: server
- os: ubuntu-latest
ruby: "3.2"
mongodb: "6.0"
mongodb: "8.0"
topology: replica_set
steps:
- name: repo checkout
Expand Down
2 changes: 1 addition & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
url = https://github.com/mongodb-labs/drivers-evergreen-tools
[submodule "spec/shared"]
path = spec/shared
url = [email protected]:mongodb-labs/mongo-ruby-spec-shared.git
url = [email protected]:mongodb-labs/mongo-ruby-spec-shared.git
2 changes: 1 addition & 1 deletion .mod/drivers-evergreen-tools
Submodule drivers-evergreen-tools updated 73 files
+2 −2 .evergreen/atlas/atlas-utils.sh
+4 −2 .evergreen/atlas/setup-atlas-cluster.sh
+3 −0 .evergreen/atlas/setup-variables.sh
+1 −1 .evergreen/atlas/teardown-atlas-cluster.sh
+3 −0 .evergreen/auth_aws/aws_tester.py
+1 −1 .evergreen/auth_aws/lib/ecs_hosted_test.sh
+1 −0 .evergreen/auth_oidc/azure/create-and-setup-vm.sh
+4 −0 .evergreen/auth_oidc/azure/run-driver-test.sh
+1 −1 .evergreen/auth_oidc/azure_func/invoke.sh
+1 −1 .evergreen/auth_oidc/azure_func/run-driver-test.sh
+4 −2 .evergreen/auth_oidc/azure_func/setup.sh
+12 −8 .evergreen/auth_oidc/gcp/setup-instance.sh
+3 −2 .evergreen/auth_oidc/gcp/setup.sh
+1 −1 .evergreen/auth_oidc/k8s/remote-scripts/run-self-test.sh
+1 −1 .evergreen/auth_oidc/k8s/remote-scripts/start-server.sh
+6 −0 .evergreen/auth_oidc/k8s/run-driver-test.sh
+2 −1 .evergreen/auth_oidc/k8s/setup.sh
+3 −2 .evergreen/auth_oidc/oidc_get_tokens.sh
+3 −2 .evergreen/auth_oidc/setup.sh
+2 −1 .evergreen/aws_lambda/run-deployed-lambda-aws-tests.sh
+1 −0 .evergreen/compile-unix.sh
+2 −1 .evergreen/compile-windows.sh
+157 −89 .evergreen/config.yml
+2 −2 .evergreen/csfle/await-servers.sh
+4 −0 .evergreen/csfle/azurekms/copy-file.sh
+1 −1 .evergreen/csfle/azurekms/create-and-setup-vm.sh
+16 −1 .evergreen/csfle/azurekms/create-vm.sh
+11 −9 .evergreen/csfle/azurekms/login.sh
+17 −12 .evergreen/csfle/azurekms/run-command.sh
+38 −0 .evergreen/csfle/azurekms/set-ssh-ip.sh
+14 −11 .evergreen/csfle/gcpkms/copy-file.sh
+4 −2 .evergreen/csfle/gcpkms/create-and-setup-instance.sh
+18 −19 .evergreen/csfle/gcpkms/create-instance.sh
+1 −1 .evergreen/csfle/gcpkms/delete-instance.sh
+1 −0 .evergreen/csfle/gcpkms/download-gcloud.sh
+3 −2 .evergreen/csfle/gcpkms/remote-scripts/start-mongodb.sh
+2 −2 .evergreen/csfle/gcpkms/remote-scripts/startup.sh
+1 −1 .evergreen/csfle/gcpkms/run-command.sh
+1 −1 .evergreen/csfle/gcpkms/setup-instance.sh
+23 −13 .evergreen/csfle/kms_failpoint_server.py
+7 −4 .evergreen/csfle/set-temp-creds.sh
+2 −0 .evergreen/csfle/stop-servers.sh
+63 −41 .evergreen/download-mongodb.sh
+4 −4 .evergreen/ensure-binary.sh
+11 −3 .evergreen/find-python3.sh
+5 −1 .evergreen/github_app/assign-reviewer.mjs
+6 −9 .evergreen/handle-paths.sh
+0 −1 .evergreen/install-dependencies.sh
+3 −5 .evergreen/install-node.sh
+33 −0 .evergreen/install-rust.sh
+6 −3 .evergreen/k8s/aks/setup-cluster.sh
+2 −2 .evergreen/k8s/configure-pod.sh
+107 −34 .evergreen/mongodl.py
+27 −0 .evergreen/ocsp/README.md
+5 −0 .evergreen/ocsp/ocsp_mock.py
+55 −0 .evergreen/ocsp/setup.sh
+13 −0 .evergreen/ocsp/teardown.sh
+69 −0 .evergreen/prepare-env-and-resources.sh
+4 −3 .evergreen/retry-with-backoff.sh
+2 −1 .evergreen/run-atlas-proxy.sh
+1 −1 .evergreen/run-load-balancer.sh
+8 −4 .evergreen/run-orchestration.sh
+2 −2 .evergreen/secrets_handling/setup-secrets.sh
+6 −3 .evergreen/serverless/create-instance.sh
+1 −1 .evergreen/serverless/delete-instance.sh
+0 −5 .evergreen/setup.sh
+42 −20 .evergreen/start-orchestration.sh
+6 −1 .evergreen/stop-orchestration.sh
+4 −4 .evergreen/teardown.sh
+9 −0 .github/workflows/tests.yml
+3 −0 .gitignore
+1 −1 .pre-commit-config.yaml
+91 −0 scripts/update_mongodb_download.py
1 change: 1 addition & 0 deletions lib/mongo/error/pool_cleared_error.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ class PoolClearedError < PoolError
#
# @api private
def initialize(address, pool)
add_label('TransientTransactionError')
super(address, pool,
"Connection to #{address} interrupted due to server monitor timeout " +
"(for pool 0x#{pool.object_id})")
Expand Down
8 changes: 4 additions & 4 deletions lib/mongo/search_index/view.rb
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ def initialize(collection, options = {})
# @param [ nil | String ] name The name to give the new search index.
#
# @return [ String ] the name of the new search index.
def create_one(definition, name: nil)
create_many([ { name: name, definition: definition } ]).first
def create_one(definition, name: nil, type: 'search')
create_many([ { name: name, definition: definition, type: type } ]).first
end

# Create multiple search indexes with a single command.
Expand Down Expand Up @@ -99,7 +99,7 @@ def each(&block)
s[:name] = requested_index_name if requested_index_name
end

collection.aggregate(
collection.with(read_concern: {}).aggregate(
[ { '$listSearchIndexes' => spec } ],
aggregate_options
)
Expand Down Expand Up @@ -200,7 +200,7 @@ def validate_search_index!(doc)
#
# @raise [ ArgumentError ] if the list contains any invalid keys
def validate_search_index_keys!(keys)
extras = keys - [ 'name', 'definition', :name, :definition ]
extras = keys - [ 'name', 'definition', 'type', :name, :definition, :type ]

raise ArgumentError, "invalid keys in search index creation: #{extras.inspect}" if extras.any?
end
Expand Down
1 change: 1 addition & 0 deletions mongo.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -38,5 +38,6 @@ Gem::Specification.new do |s|

s.required_ruby_version = ">= 2.5"

s.add_dependency 'base64'
s.add_dependency 'bson', '>=4.14.1', '<6.0.0'
end
4 changes: 2 additions & 2 deletions spec/README.aws-auth.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ AWS authentication, and add a bootstrap user:

Then connect as the bootstrap user and create AWS-mapped users:

mongo mongodb://root:toor@localhost:27017
mongosh mongodb://root:toor@localhost:27017

# In the mongo shell:
use $external
Expand All @@ -41,7 +41,7 @@ With the server user created, it is possible to authenticate using AWS.
The following example uses regular user credentials for an IAM user
created as described in the next section;

mongo 'mongodb://AKIAAAAAAAAAAAA:t9t2mawssecretkey@localhost:27017/?authMechanism=MONGODB-AWS&authsource=$external'
mongosh 'mongodb://AKIAAAAAAAAAAAA:t9t2mawssecretkey@localhost:27017/?authMechanism=MONGODB-AWS&authsource=$external'

To authenticate, provide the IAM user's access key id as the username and
secret access key as the password. Note that the username and the password
Expand Down
6 changes: 3 additions & 3 deletions spec/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@ to a variable as follows:

Use the MongoDB shell to execute this command:

mongo --tls \
mongosh --tls \
--tlsCAFile `pwd`/spec/support/certificates/ca.crt \
--tlsCertificateKeyFile `pwd`/spec/support/certificates/client-x509.pem \
-u bootstrap -p bootstrap \
Expand All @@ -301,14 +301,14 @@ Use the MongoDB shell to execute this command:
Verify that authentication is required by running the following command, which
should fail:

mongo --tls \
mongosh --tls \
--tlsCAFile `pwd`/spec/support/certificates/ca.crt \
--tlsCertificateKeyFile `pwd`/spec/support/certificates/client-x509.pem \
--eval 'db.serverStatus()'

Verify that X.509 authentication works by running the following command:

mongo --tls \
mongosh --tls \
--tlsCAFile `pwd`/spec/support/certificates/ca.crt \
--tlsCertificateKeyFile `pwd`/spec/support/certificates/client-x509.pem \
--authenticationDatabase '$external' \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@
end

let(:error_regex) do
/SocketError: getaddrinfo:/
/(SocketError|ResolutionError): getaddrinfo:/
end

it_behaves_like 'raising a KMS error'
Expand Down
Loading

0 comments on commit 49a90e5

Please sign in to comment.