Skip to content

OTEL #3

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

Open
wants to merge 14 commits into
base: master
Choose a base branch
from
Open
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
27 changes: 6 additions & 21 deletions .evergreen/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -927,11 +927,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 @@ -1363,7 +1358,7 @@ buildvariants:
- matrix_name: "mongo-5.x"
matrix_spec:
ruby: ["ruby-3.3", "ruby-3.2", "jruby-9.4"]
mongodb-version: ['5.3']
mongodb-version: ['5.0']
topology: ["standalone", "replica-set", "sharded-cluster"]
os: ubuntu1804
display_name: "${mongodb-version} ${topology} ${auth-and-ssl} ${ruby}"
Expand Down Expand Up @@ -1524,15 +1519,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: "5.3"
ruby: "ruby-3.3"
mongodb-version: "7.0"
topology: standalone
os: ubuntu1804
os: ubuntu2204
display_name: "${mongodb-version} ${topology} ${auth-and-ssl} ${ruby}"
tasks:
- name: "test-mlaunch"
Expand Down Expand Up @@ -1721,13 +1711,8 @@ buildvariants:
auth-and-ssl: [ aws-regular, aws-assume-role, aws-ecs, aws-web-identity ]
ruby: "ruby-3.3"
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: "5.3"
os: ubuntu1804
mongodb-version: "7.0"
os: ubuntu2204
display_name: "AWS ${auth-and-ssl} ${mongodb-version} ${ruby}"
tasks:
- name: "test-aws-auth"
Expand Down
5 changes: 0 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
25 changes: 7 additions & 18 deletions .evergreen/config/standard.yml.erb
Original file line number Diff line number Diff line change
Expand Up @@ -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
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
11 changes: 8 additions & 3 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 @@ -215,6 +219,7 @@ if test -n "$FLE"; then
python3 -u .evergreen/csfle/kms_http_server.py --ca_file .evergreen/x509gen/ca.pem --cert_file .evergreen/x509gen/server.pem --port 8002 --require_client_cert &
python3 -u .evergreen/csfle/kms_kmip_server.py &
python3 -u .evergreen/csfle/fake_azure.py &
python3 -u .evergreen/csfle/kms_failpoint_server.py --port 9003 &

# Obtain temporary AWS credentials
PYTHON=python3 . .evergreen/csfle/set-temp-creds.sh
Expand Down Expand Up @@ -286,7 +291,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
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 = git@github.com:mongodb-labs/mongo-ruby-spec-shared.git
url = https://github.com/mongodb-labs/mongo-ruby-spec-shared
3 changes: 3 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -110,3 +110,6 @@ Style/TrailingCommaInArrayLiteral:

Style/TrailingCommaInHashLiteral:
Enabled: false

RSpec/ExampleLength:
Max: 10
14 changes: 5 additions & 9 deletions gemfiles/standard.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,10 @@ def standard_dependencies
gem 'yajl-ruby', platforms: :mri, require: false
gem 'celluloid', platforms: :mri, require: false

# for static analysis -- ignore ruby < 2.6 because of rubocop
# version incompatibilities
if RUBY_VERSION > '2.5.99'
gem 'rubocop', '~> 1.45.1'
gem 'rubocop-performance', '~> 1.16.0'
gem 'rubocop-rake', '~> 0.6.0'
gem 'rubocop-rspec', '~> 2.18.1'
end
gem 'rubocop', '~> 1.45.1'
gem 'rubocop-performance', '~> 1.16.0'
gem 'rubocop-rake', '~> 0.6.0'
gem 'rubocop-rspec', '~> 2.18.1'

platform :mri do
# Debugger for VSCode.
Expand Down Expand Up @@ -68,6 +64,6 @@ def standard_dependencies
gem 'ruby-lsp', platforms: :mri
end

gem 'libmongocrypt-helper', '~> 1.11.0' if ENV['FLE'] == 'helper'
gem 'libmongocrypt-helper', '~> 1.12.0' if ENV['FLE'] == 'helper'
end
# rubocop:enable Metrics/AbcSize, Metrics/MethodLength, Metrics/BlockLength
1 change: 1 addition & 0 deletions lib/mongo.rb
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@
require 'mongo/write_concern'
require 'mongo/utils'
require 'mongo/config'
require 'mongo/open_telemetry'

module Mongo

Expand Down
19 changes: 13 additions & 6 deletions lib/mongo/auth/credential_cache.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,19 +22,24 @@ module Auth
#
# @api private
module CredentialCache

class << self
attr_reader :store
end

MUTEX = Mutex.new

module_function def get(key)
@store ||= {}
@store[key]
MUTEX.synchronize do
@store ||= {}
@store[key]
end
end

module_function def set(key, value)
@store ||= {}
@store[key] = value
MUTEX.synchronize do
@store ||= {}
@store[key] = value
end
end

module_function def cache(key)
Expand All @@ -47,7 +52,9 @@ class << self
end

module_function def clear
@store = {}
MUTEX.synchronize do
@store = {}
end
end
end
end
Expand Down
Loading