Skip to content

Commit 45bfc81

Browse files
authored
RUBY-3164 Use mongosh instead of mongo (mongodb#2905)
* RUBY-3164 use mongosh instead of mongo * config tweaks * use correct ubuntu version * submodule shenanigans trying to reference the experimental spec/shared changes for installing mongosh * fetch updates to spec/shared * use the distro detected by drivers-evergreen-tools * there is no 5.3 in the mongodb download script, so let's ignore it * bump spec/shared * make sure PROJECT_DIRECTORY is set so the AWS tests work * swich spec/shared back to canonical repo
1 parent f8e5583 commit 45bfc81

11 files changed

+35
-62
lines changed

.evergreen/config.yml

Lines changed: 6 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -927,11 +927,6 @@ axes:
927927
display_name: "6.0"
928928
variables:
929929
MONGODB_VERSION: "6.0"
930-
- id: "5.3"
931-
display_name: "5.3"
932-
variables:
933-
MONGODB_VERSION: "5.3"
934-
CRYPT_SHARED_VERSION: "6.0.5"
935930
- id: "5.0"
936931
display_name: "5.0"
937932
variables:
@@ -1363,7 +1358,7 @@ buildvariants:
13631358
- matrix_name: "mongo-5.x"
13641359
matrix_spec:
13651360
ruby: ["ruby-3.3", "ruby-3.2", "jruby-9.4"]
1366-
mongodb-version: ['5.3']
1361+
mongodb-version: ['5.0']
13671362
topology: ["standalone", "replica-set", "sharded-cluster"]
13681363
os: ubuntu1804
13691364
display_name: "${mongodb-version} ${topology} ${auth-and-ssl} ${ruby}"
@@ -1524,15 +1519,10 @@ buildvariants:
15241519
- matrix_name: "x509-tests"
15251520
matrix_spec:
15261521
auth-and-ssl: "x509"
1527-
ruby: 'ruby-3.1'
1528-
# needs the latest_5x_mdb because run-tests.sh uses `mongo` to configure
1529-
# the server for certain auth mechanisms. Once run-tests.sh is made smart
1530-
# enough to install mongosh, and then use either mongo or mongosh
1531-
# (depending on server version and what's available), we can bump this to
1532-
# the latest stable db version.
1533-
mongodb-version: "5.3"
1522+
ruby: "ruby-3.3"
1523+
mongodb-version: "7.0"
15341524
topology: standalone
1535-
os: ubuntu1804
1525+
os: ubuntu2204
15361526
display_name: "${mongodb-version} ${topology} ${auth-and-ssl} ${ruby}"
15371527
tasks:
15381528
- name: "test-mlaunch"
@@ -1721,13 +1711,8 @@ buildvariants:
17211711
auth-and-ssl: [ aws-regular, aws-assume-role, aws-ecs, aws-web-identity ]
17221712
ruby: "ruby-3.3"
17231713
topology: standalone
1724-
# needs the latest_5x_mdb because run-tests.sh uses `mongo` to configure
1725-
# the server for certain auth mechanisms. Once run-tests.sh is made smart
1726-
# enough to install mongosh, and then use either mongo or mongosh
1727-
# (depending on server version and what's available), we can bump this to
1728-
# the latest stable db version.
1729-
mongodb-version: "5.3"
1730-
os: ubuntu1804
1714+
mongodb-version: "7.0"
1715+
os: ubuntu2204
17311716
display_name: "AWS ${auth-and-ssl} ${mongodb-version} ${ruby}"
17321717
tasks:
17331718
- name: "test-aws-auth"

.evergreen/config/axes.yml.erb

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,6 @@ axes:
3030
display_name: "6.0"
3131
variables:
3232
MONGODB_VERSION: "6.0"
33-
- id: "5.3"
34-
display_name: "5.3"
35-
variables:
36-
MONGODB_VERSION: "5.3"
37-
CRYPT_SHARED_VERSION: "6.0.5"
3833
- id: "5.0"
3934
display_name: "5.0"
4035
variables:

.evergreen/config/standard.yml.erb

Lines changed: 7 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,8 @@
3737
actual_and_upcoming_mdb = %w( latest 8.0 7.0 )
3838

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

42-
all_dbs = %w(latest 8.0 7.0 6.0 5.3 5.0 4.4 4.2 4.0 3.6)
41+
all_dbs = %w(latest 8.0 7.0 6.0 5.0 4.4 4.2 4.0 3.6)
4342
%>
4443

4544
buildvariants:
@@ -87,7 +86,7 @@ buildvariants:
8786
- matrix_name: "mongo-5.x"
8887
matrix_spec:
8988
ruby: <%= recent_rubies %>
90-
mongodb-version: ['5.3']
89+
mongodb-version: ['5.0']
9190
topology: <%= topologies %>
9291
os: ubuntu1804
9392
display_name: "${mongodb-version} ${topology} ${auth-and-ssl} ${ruby}"
@@ -248,15 +247,10 @@ buildvariants:
248247
- matrix_name: "x509-tests"
249248
matrix_spec:
250249
auth-and-ssl: "x509"
251-
ruby: 'ruby-3.1'
252-
# needs the latest_5x_mdb because run-tests.sh uses `mongo` to configure
253-
# the server for certain auth mechanisms. Once run-tests.sh is made smart
254-
# enough to install mongosh, and then use either mongo or mongosh
255-
# (depending on server version and what's available), we can bump this to
256-
# the latest stable db version.
257-
mongodb-version: <%= latest_5x_mdb %>
250+
ruby: <%= latest_ruby %>
251+
mongodb-version: <%= latest_stable_mdb %>
258252
topology: standalone
259-
os: ubuntu1804
253+
os: ubuntu2204
260254
display_name: "${mongodb-version} ${topology} ${auth-and-ssl} ${ruby}"
261255
tasks:
262256
- name: "test-mlaunch"
@@ -390,13 +384,8 @@ buildvariants:
390384
auth-and-ssl: [ aws-regular, aws-assume-role, aws-ecs, aws-web-identity ]
391385
ruby: <%= latest_ruby %>
392386
topology: standalone
393-
# needs the latest_5x_mdb because run-tests.sh uses `mongo` to configure
394-
# the server for certain auth mechanisms. Once run-tests.sh is made smart
395-
# enough to install mongosh, and then use either mongo or mongosh
396-
# (depending on server version and what's available), we can bump this to
397-
# the latest stable db version.
398-
mongodb-version: <%= latest_5x_mdb %>
399-
os: ubuntu1804
387+
mongodb-version: <%= latest_stable_mdb %>
388+
os: ubuntu2204
400389
display_name: "AWS ${auth-and-ssl} ${mongodb-version} ${ruby}"
401390
tasks:
402391
- name: "test-aws-auth"

.evergreen/functions-kerberos.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,8 @@ configure_local_kerberos() {
7676
EOT
7777
`"
7878

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

.evergreen/run-tests-kerberos-integration.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ configure_kerberos_ip_addr
5555
# To test authentication using the mongo shell, note that the host name
5656
# must be uppercased when it is used in the username.
5757
# The following call works when using the docker image:
58-
# /opt/mongodb/bin/mongo --host $SASL_HOST --authenticationMechanism=GSSAPI \
58+
# /opt/mongodb/bin/mongosh --host $SASL_HOST --authenticationMechanism=GSSAPI \
5959
# --authenticationDatabase='$external' --username $SASL_USER@`echo $SASL_HOST |tr a-z A-Z`
6060

6161
echo "Install dependencies"

.evergreen/run-tests.sh

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,10 @@ else
2222
set -x
2323
fi
2424

25+
if test -z "$PROJECT_DIRECTORY"; then
26+
PROJECT_DIRECTORY=`realpath $(dirname $0)/..`
27+
fi
28+
2529
MRSS_ROOT=`dirname "$0"`/../spec/shared
2630

2731
. $MRSS_ROOT/shlib/distro.sh
@@ -41,7 +45,7 @@ set_env_vars
4145
set_env_python
4246
set_env_ruby
4347

44-
prepare_server $arch
48+
prepare_server
4549

4650
if test "$DOCKER_PRELOAD" != 1; then
4751
install_mlaunch_venv
@@ -118,7 +122,7 @@ elif test "$AUTH" = x509; then
118122
EOT
119123
`"
120124

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

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

292296
set_fcv

.gitmodules

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@
33
url = https://github.com/mongodb-labs/drivers-evergreen-tools
44
[submodule "spec/shared"]
55
path = spec/shared
6-
url = [email protected]:mongodb-labs/mongo-ruby-spec-shared.git
6+
url = [email protected]:mongodb-labs/mongo-ruby-spec-shared.git

spec/README.aws-auth.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ AWS authentication, and add a bootstrap user:
2424

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

27-
mongo mongodb://root:toor@localhost:27017
27+
mongosh mongodb://root:toor@localhost:27017
2828

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

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

4646
To authenticate, provide the IAM user's access key id as the username and
4747
secret access key as the password. Note that the username and the password

spec/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -292,7 +292,7 @@ to a variable as follows:
292292

293293
Use the MongoDB shell to execute this command:
294294

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

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

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

311-
mongo --tls \
311+
mongosh --tls \
312312
--tlsCAFile `pwd`/spec/support/certificates/ca.crt \
313313
--tlsCertificateKeyFile `pwd`/spec/support/certificates/client-x509.pem \
314314
--authenticationDatabase '$external' \

spec/shared

spec/support/certificates/README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -81,26 +81,26 @@ To sum up, openssl's command line tools appear to only handle certificate
8181
chains provided by the client when the server is verifying them, not the
8282
other way around and not when trying to standalone verify the chain.
8383

84-
## Manual Testing - mongo
84+
## Manual Testing - mongosh
8585

86-
When it comes to `mongod` and `mongo`, certificate chains are supported in
86+
When it comes to `mongod` and `mongosh`, certificate chains are supported in
8787
both directions:
8888

8989
mongod --sslMode requireSSL \
9090
--sslCAFile ca.crt \
9191
--sslPEMKeyFile server-second-level-bundle.pem \
9292
--sslClientCertificate client.pem
9393

94-
mongo --host localhost --ssl \
94+
mongosh --host localhost --ssl \
9595
--sslCAFile ca.crt \
9696
--sslPEMKeyFile client-second-level-bundle.pem
9797

98-
The `--host` option needs to be given to `mongo` because the certificates here
98+
The `--host` option needs to be given to `mongosh` because the certificates here
9999
do not include 127.0.0.1 in subject alternate name.
100100

101101
If the intermediate certificate is not provided, the connection should fail.
102102

103103
# Expected to fail
104-
mongo --host localhost --ssl \
104+
mongosh --host localhost --ssl \
105105
--sslCAFile ca.crt \
106106
--sslPEMKeyFile client-second-level.pem

0 commit comments

Comments
 (0)