From ace13526bfc9662a5493bb0d7ca6c905df7fe3c8 Mon Sep 17 00:00:00 2001 From: Jamis Buck Date: Mon, 28 Oct 2024 09:45:22 -0600 Subject: [PATCH 01/10] RUBY-3164 use mongosh instead of mongo --- .evergreen/config.yml | 14 ++------------ .evergreen/config/standard.yml.erb | 15 ++------------- .evergreen/functions-kerberos.sh | 4 ++-- .evergreen/run-tests-kerberos-integration.sh | 2 +- .evergreen/run-tests.sh | 4 ++-- spec/README.aws-auth.md | 4 ++-- spec/README.md | 6 +++--- spec/support/certificates/README.md | 10 +++++----- 8 files changed, 19 insertions(+), 40 deletions(-) diff --git a/.evergreen/config.yml b/.evergreen/config.yml index 0dfd9fab60..91f9599434 100644 --- a/.evergreen/config.yml +++ b/.evergreen/config.yml @@ -1525,12 +1525,7 @@ buildvariants: 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" + mongodb-version: "7.0" topology: standalone os: ubuntu1804 display_name: "${mongodb-version} ${topology} ${auth-and-ssl} ${ruby}" @@ -1721,12 +1716,7 @@ 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" + mongodb-version: "7.0" os: ubuntu1804 display_name: "AWS ${auth-and-ssl} ${mongodb-version} ${ruby}" tasks: diff --git a/.evergreen/config/standard.yml.erb b/.evergreen/config/standard.yml.erb index 83cf0157db..9bf5b71cd6 100644 --- a/.evergreen/config/standard.yml.erb +++ b/.evergreen/config/standard.yml.erb @@ -37,7 +37,6 @@ 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) %> @@ -249,12 +248,7 @@ buildvariants: 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 %> + mongodb-version: <%= latest_stable_mdb %> topology: standalone os: ubuntu1804 display_name: "${mongodb-version} ${topology} ${auth-and-ssl} ${ruby}" @@ -390,12 +384,7 @@ 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 %> + mongodb-version: <%= latest_stable_mdb %> os: ubuntu1804 display_name: "AWS ${auth-and-ssl} ${mongodb-version} ${ruby}" tasks: diff --git a/.evergreen/functions-kerberos.sh b/.evergreen/functions-kerberos.sh index 310e58218c..2ce893f175 100644 --- a/.evergreen/functions-kerberos.sh +++ b/.evergreen/functions-kerberos.sh @@ -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 diff --git a/.evergreen/run-tests-kerberos-integration.sh b/.evergreen/run-tests-kerberos-integration.sh index e7002d898e..b56e22ec1a 100755 --- a/.evergreen/run-tests-kerberos-integration.sh +++ b/.evergreen/run-tests-kerberos-integration.sh @@ -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" diff --git a/.evergreen/run-tests.sh b/.evergreen/run-tests.sh index a308e78486..23a603fb90 100755 --- a/.evergreen/run-tests.sh +++ b/.evergreen/run-tests.sh @@ -118,7 +118,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 \ @@ -286,7 +286,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 diff --git a/spec/README.aws-auth.md b/spec/README.aws-auth.md index 5f4bfef08d..82a757ca47 100644 --- a/spec/README.aws-auth.md +++ b/spec/README.aws-auth.md @@ -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 @@ -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 diff --git a/spec/README.md b/spec/README.md index cd100311c3..98d4b5a0d2 100644 --- a/spec/README.md +++ b/spec/README.md @@ -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 \ @@ -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' \ diff --git a/spec/support/certificates/README.md b/spec/support/certificates/README.md index c6251ea80b..d447a19c66 100644 --- a/spec/support/certificates/README.md +++ b/spec/support/certificates/README.md @@ -81,9 +81,9 @@ To sum up, openssl's command line tools appear to only handle certificate chains provided by the client when the server is verifying them, not the other way around and not when trying to standalone verify the chain. -## Manual Testing - mongo +## Manual Testing - mongosh -When it comes to `mongod` and `mongo`, certificate chains are supported in +When it comes to `mongod` and `mongosh`, certificate chains are supported in both directions: mongod --sslMode requireSSL \ @@ -91,16 +91,16 @@ both directions: --sslPEMKeyFile server-second-level-bundle.pem \ --sslClientCertificate client.pem - mongo --host localhost --ssl \ + mongosh --host localhost --ssl \ --sslCAFile ca.crt \ --sslPEMKeyFile client-second-level-bundle.pem -The `--host` option needs to be given to `mongo` because the certificates here +The `--host` option needs to be given to `mongosh` because the certificates here do not include 127.0.0.1 in subject alternate name. If the intermediate certificate is not provided, the connection should fail. # Expected to fail - mongo --host localhost --ssl \ + mongosh --host localhost --ssl \ --sslCAFile ca.crt \ --sslPEMKeyFile client-second-level.pem From 6f2cbaaca9639b5822f9a59359f9aa1f0bb7ab40 Mon Sep 17 00:00:00 2001 From: Jamis Buck Date: Mon, 28 Oct 2024 10:47:41 -0600 Subject: [PATCH 02/10] config tweaks --- .evergreen/config.yml | 4 ++-- .evergreen/config/standard.yml.erb | 4 ++-- .github/workflows/test.yml | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.evergreen/config.yml b/.evergreen/config.yml index 91f9599434..5c6fcfd73e 100644 --- a/.evergreen/config.yml +++ b/.evergreen/config.yml @@ -1524,10 +1524,10 @@ buildvariants: - matrix_name: "x509-tests" matrix_spec: auth-and-ssl: "x509" - ruby: 'ruby-3.1' + 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" diff --git a/.evergreen/config/standard.yml.erb b/.evergreen/config/standard.yml.erb index 9bf5b71cd6..a346f1f0f5 100644 --- a/.evergreen/config/standard.yml.erb +++ b/.evergreen/config/standard.yml.erb @@ -247,10 +247,10 @@ buildvariants: - matrix_name: "x509-tests" matrix_spec: auth-and-ssl: "x509" - ruby: 'ruby-3.1' + 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" diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index e3f468fe8b..713c394b55 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -17,7 +17,7 @@ jobs: 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"] + mongodb: ["4.4", "5.0", "6.0", "7.0"] topology: [replica_set, sharded_cluster] include: - os: macos From 783a0b17841ab1beb6919d65c69b577d03ef308b Mon Sep 17 00:00:00 2001 From: Jamis Buck Date: Mon, 28 Oct 2024 16:01:47 -0600 Subject: [PATCH 03/10] use correct ubuntu version --- .evergreen/config.yml | 2 +- .evergreen/config/standard.yml.erb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.evergreen/config.yml b/.evergreen/config.yml index 5c6fcfd73e..563aaaacf7 100644 --- a/.evergreen/config.yml +++ b/.evergreen/config.yml @@ -1717,7 +1717,7 @@ buildvariants: ruby: "ruby-3.3" topology: standalone mongodb-version: "7.0" - os: ubuntu1804 + os: ubuntu2204 display_name: "AWS ${auth-and-ssl} ${mongodb-version} ${ruby}" tasks: - name: "test-aws-auth" diff --git a/.evergreen/config/standard.yml.erb b/.evergreen/config/standard.yml.erb index a346f1f0f5..942a269e91 100644 --- a/.evergreen/config/standard.yml.erb +++ b/.evergreen/config/standard.yml.erb @@ -385,7 +385,7 @@ buildvariants: ruby: <%= latest_ruby %> topology: standalone mongodb-version: <%= latest_stable_mdb %> - os: ubuntu1804 + os: ubuntu2204 display_name: "AWS ${auth-and-ssl} ${mongodb-version} ${ruby}" tasks: - name: "test-aws-auth" From a83f91bfa66bc76c25ae8018f49d763c1d6d9c97 Mon Sep 17 00:00:00 2001 From: Jamis Buck Date: Mon, 28 Oct 2024 16:11:08 -0600 Subject: [PATCH 04/10] submodule shenanigans trying to reference the experimental spec/shared changes for installing mongosh --- .gitmodules | 3 ++- spec/shared | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.gitmodules b/.gitmodules index e1bab0957a..5fee349fb4 100644 --- a/.gitmodules +++ b/.gitmodules @@ -3,4 +3,5 @@ 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 = git@github.com:jamis/mongo-ruby-spec-shared.git + branch = install-mongosh diff --git a/spec/shared b/spec/shared index 2fe5724b0a..80f59da9d9 160000 --- a/spec/shared +++ b/spec/shared @@ -1 +1 @@ -Subproject commit 2fe5724b0a586fbeac602f15f7d43ccc7bbe531b +Subproject commit 80f59da9d9a189052b751429f75cc89561fa7d80 From e8860a60dbbcc8e27f2f00e0ad3b8f53c662b5b0 Mon Sep 17 00:00:00 2001 From: Jamis Buck Date: Mon, 28 Oct 2024 16:48:26 -0600 Subject: [PATCH 05/10] fetch updates to spec/shared --- spec/shared | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/shared b/spec/shared index 80f59da9d9..11755410f9 160000 --- a/spec/shared +++ b/spec/shared @@ -1 +1 @@ -Subproject commit 80f59da9d9a189052b751429f75cc89561fa7d80 +Subproject commit 11755410f919adaa6cdde190f77075525e66d311 From 5f2f4900af105294c1e3fc444deab1e5edb7f5d2 Mon Sep 17 00:00:00 2001 From: Jamis Buck Date: Mon, 28 Oct 2024 16:52:15 -0600 Subject: [PATCH 06/10] use the distro detected by drivers-evergreen-tools --- .evergreen/run-tests.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.evergreen/run-tests.sh b/.evergreen/run-tests.sh index 23a603fb90..b07262ff12 100755 --- a/.evergreen/run-tests.sh +++ b/.evergreen/run-tests.sh @@ -41,7 +41,7 @@ set_env_vars set_env_python set_env_ruby -prepare_server $arch +prepare_server if test "$DOCKER_PRELOAD" != 1; then install_mlaunch_venv From 9b2167e878b5ee5af3919990d39bf5bd5b6fdbf8 Mon Sep 17 00:00:00 2001 From: Jamis Buck Date: Mon, 28 Oct 2024 16:56:33 -0600 Subject: [PATCH 07/10] there is no 5.3 in the mongodb download script, so let's ignore it --- .evergreen/config.yml | 7 +------ .evergreen/config/axes.yml.erb | 5 ----- .evergreen/config/standard.yml.erb | 4 ++-- 3 files changed, 3 insertions(+), 13 deletions(-) diff --git a/.evergreen/config.yml b/.evergreen/config.yml index 563aaaacf7..10fb23b8cf 100644 --- a/.evergreen/config.yml +++ b/.evergreen/config.yml @@ -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: @@ -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}" diff --git a/.evergreen/config/axes.yml.erb b/.evergreen/config/axes.yml.erb index dbdcfbfdb6..44e018f5de 100644 --- a/.evergreen/config/axes.yml.erb +++ b/.evergreen/config/axes.yml.erb @@ -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: diff --git a/.evergreen/config/standard.yml.erb b/.evergreen/config/standard.yml.erb index 942a269e91..4c4ea57630 100644 --- a/.evergreen/config/standard.yml.erb +++ b/.evergreen/config/standard.yml.erb @@ -38,7 +38,7 @@ recent_mdb = %w( 8.0 7.0 ) - 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: @@ -86,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}" From 9b6a9b65513bd399120f6f4d4d1e8f40a07292ff Mon Sep 17 00:00:00 2001 From: Jamis Buck Date: Thu, 31 Oct 2024 10:55:57 -0600 Subject: [PATCH 08/10] bump spec/shared --- spec/shared | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/shared b/spec/shared index 11755410f9..6f160caf99 160000 --- a/spec/shared +++ b/spec/shared @@ -1 +1 @@ -Subproject commit 11755410f919adaa6cdde190f77075525e66d311 +Subproject commit 6f160caf99b54d169be6a764a980bff8d9d98385 From 9cdb7640df98c78572bc18df1d5f61a3355ee2a8 Mon Sep 17 00:00:00 2001 From: Jamis Buck Date: Thu, 31 Oct 2024 14:32:15 -0600 Subject: [PATCH 09/10] make sure PROJECT_DIRECTORY is set so the AWS tests work --- .evergreen/run-tests.sh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.evergreen/run-tests.sh b/.evergreen/run-tests.sh index b07262ff12..653ca3b480 100755 --- a/.evergreen/run-tests.sh +++ b/.evergreen/run-tests.sh @@ -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 From ba6ab78bb01b667a4d09410ef68314e6351464d4 Mon Sep 17 00:00:00 2001 From: Jamis Buck Date: Fri, 1 Nov 2024 08:06:14 -0600 Subject: [PATCH 10/10] swich spec/shared back to canonical repo --- .gitmodules | 3 +-- spec/shared | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/.gitmodules b/.gitmodules index 5fee349fb4..6d428f359d 100644 --- a/.gitmodules +++ b/.gitmodules @@ -3,5 +3,4 @@ url = https://github.com/mongodb-labs/drivers-evergreen-tools [submodule "spec/shared"] path = spec/shared - url = git@github.com:jamis/mongo-ruby-spec-shared.git - branch = install-mongosh + url = git@github.com:mongodb-labs/mongo-ruby-spec-shared.git diff --git a/spec/shared b/spec/shared index 6f160caf99..d73378a4cc 160000 --- a/spec/shared +++ b/spec/shared @@ -1 +1 @@ -Subproject commit 6f160caf99b54d169be6a764a980bff8d9d98385 +Subproject commit d73378a4cc9d07cda8375e1300c15add2c6b9a6c