diff --git a/.evergreen/config.yml b/.evergreen/config.yml index ba305a39f9..338139f77b 100644 --- a/.evergreen/config.yml +++ b/.evergreen/config.yml @@ -120,19 +120,7 @@ functions: export ATLAS_FREE_TIER_URI="${atlas_free_tier_uri}" export ATLAS_TLS11_URI="${atlas_tls11_uri}" export ATLAS_TLS12_URI="${atlas_tls12_uri}" - export ATLAS_SERVERLESS_URI="${atlas_serverless_uri}" - export ATLAS_SERVERLESS_LB_URI="${atlas_serverless_lb_uri}" - export ATLAS_X509_CERT_BASE64="${atlas_x509_cert_base64}" - export ATLAS_X509_URI="${atlas_x509}" - export ATLAS_X509_DEV_CERT_BASE64="${atlas_x509_dev_cert_base64}" - export ATLAS_X509_DEV_URI="${atlas_x509_dev}" export RVM_RUBY="${RVM_RUBY}" - - export SERVERLESS_DRIVERS_GROUP="${SERVERLESS_DRIVERS_GROUP}" - export SERVERLESS_API_PUBLIC_KEY="${SERVERLESS_API_PUBLIC_KEY}" - export SERVERLESS_API_PRIVATE_KEY="${SERVERLESS_API_PRIVATE_KEY}" - export SERVERLESS_ATLAS_USER="${SERVERLESS_ATLAS_USER}" - export SERVERLESS_ATLAS_PASSWORD="${SERVERLESS_ATLAS_PASSWORD}" EOT # See what we've done @@ -364,17 +352,6 @@ functions: script: | rm -f .env.private - "build and test docker image": - - command: shell.exec - type: test - params: - shell: bash - working_dir: "src" - script: | - ${PREPARE_SHELL} - set -x - .evergreen/test-on-docker -d ${os} MONGODB_VERSION=${mongodb-version} TOPOLOGY=${topology} RVM_RUBY=${ruby} -s .evergreen/run-tests.sh TEST_CMD=true ${PRELOAD_ARG} - "run benchmarks": - command: shell.exec type: test @@ -405,23 +382,6 @@ functions: fi .evergreen/run-tests.sh - "run tests via docker": - - command: shell.exec - type: test - params: - shell: bash - working_dir: "src" - script: | - ${PREPARE_SHELL} - # Needed for generating temporary aws credentials. - if [ -n "${FLE}" ]; - then - export AWS_ACCESS_KEY_ID="${fle_aws_key}" - export AWS_SECRET_ACCESS_KEY="${fle_aws_secret}" - export AWS_DEFAULT_REGION="${fle_aws_region}" - fi - .evergreen/run-tests-docker.sh - "run AWS auth tests": - command: shell.exec type: test @@ -442,16 +402,6 @@ functions: ${PREPARE_SHELL} .evergreen/run-tests-kerberos-unit.sh - "run Kerberos integration tests": - - command: shell.exec - type: test - params: - shell: bash - working_dir: "src" - script: | - ${PREPARE_SHELL} - .evergreen/run-tests-kerberos-integration.sh - "run Atlas tests": - command: shell.exec type: test @@ -471,24 +421,6 @@ functions: ATLAS_X509_DEV_URI="${atlas_x509_dev}" \ .evergreen/run-tests-atlas.sh - "run serverless tests": - - command: shell.exec - type: test - params: - shell: bash - working_dir: "src" - script: | - ${PREPARE_SHELL} - # Needed for generating temporary aws credentials. - if [ -n "${FLE}" ]; - then - export AWS_ACCESS_KEY_ID="${fle_aws_key}" - export AWS_SECRET_ACCESS_KEY="${fle_aws_secret}" - export AWS_DEFAULT_REGION="${fle_aws_region}" - fi - - CRYPT_SHARED_LIB_PATH="${CRYPT_SHARED_LIB_PATH}" SERVERLESS=1 SSL=ssl RVM_RUBY="${RVM_RUBY}" SINGLE_MONGOS="${SINGLE_MONGOS}" SERVERLESS_URI="${SERVERLESS_URI}" FLE="${FLE}" SERVERLESS_MONGODB_VERSION="${SERVERLESS_MONGODB_VERSION}" .evergreen/run-tests-serverless.sh - pre: - func: "fetch source" - func: "create expansions" @@ -502,35 +434,6 @@ post: - func: "upload test results to s3" task_groups: - - name: serverless_task_group - setup_group_can_fail_task: true - setup_group_timeout_secs: 1800 # 30 minutes - setup_group: - - func: "fetch source" - - func: "create expansions" - - command: ec2.assume_role - params: - role_arn: ${aws_test_secrets_role} - - command: shell.exec - params: - shell: "bash" - script: | - ${PREPARE_SHELL} - bash ${DRIVERS_TOOLS}/.evergreen/serverless/setup-secrets.sh - bash ${DRIVERS_TOOLS}/.evergreen/serverless/create-instance.sh - - command: expansions.update - params: - file: serverless-expansion.yml - teardown_task: - - command: shell.exec - params: - script: | - ${PREPARE_SHELL} - bash ${DRIVERS_TOOLS}/.evergreen/serverless/delete-instance.sh - - func: "upload test results" - tasks: - - "test-serverless" - - name: testatlas_full_task_group setup_group_can_fail_task: true setup_group_timeout_secs: 1800 # 30 minutes @@ -716,26 +619,12 @@ tasks: - name: "test-atlas" commands: - func: "run Atlas tests" - - name: "test-serverless" - commands: - - func: "export FLE credentials" - - func: "run serverless tests" - - name: "test-docker" - commands: - - func: "build and test docker image" - name: "test-mlaunch" commands: - func: "run tests" - name: "driver-bench" commands: - func: "run benchmarks" - - name: "test-via-docker" - commands: - - func: "run tests via docker" - - name: "test-kerberos-integration" - commands: - - func: "export Kerberos credentials" - - func: "run Kerberos integration tests" - name: "test-kerberos" commands: - func: "run Kerberos unit tests" @@ -746,10 +635,6 @@ tasks: commands: - func: "export FLE credentials" - func: "run tests" - - name: "test-fle-via-docker" - commands: - - func: "export FLE credentials" - - func: "run tests via docker" - name: "test-aws-auth" commands: - func: "export AWS auth credentials" diff --git a/.evergreen/config/common.yml.erb b/.evergreen/config/common.yml.erb index 64fd622a11..85fddd3dd0 100644 --- a/.evergreen/config/common.yml.erb +++ b/.evergreen/config/common.yml.erb @@ -117,19 +117,7 @@ functions: export ATLAS_FREE_TIER_URI="${atlas_free_tier_uri}" export ATLAS_TLS11_URI="${atlas_tls11_uri}" export ATLAS_TLS12_URI="${atlas_tls12_uri}" - export ATLAS_SERVERLESS_URI="${atlas_serverless_uri}" - export ATLAS_SERVERLESS_LB_URI="${atlas_serverless_lb_uri}" - export ATLAS_X509_CERT_BASE64="${atlas_x509_cert_base64}" - export ATLAS_X509_URI="${atlas_x509}" - export ATLAS_X509_DEV_CERT_BASE64="${atlas_x509_dev_cert_base64}" - export ATLAS_X509_DEV_URI="${atlas_x509_dev}" export RVM_RUBY="${RVM_RUBY}" - - export SERVERLESS_DRIVERS_GROUP="${SERVERLESS_DRIVERS_GROUP}" - export SERVERLESS_API_PUBLIC_KEY="${SERVERLESS_API_PUBLIC_KEY}" - export SERVERLESS_API_PRIVATE_KEY="${SERVERLESS_API_PRIVATE_KEY}" - export SERVERLESS_ATLAS_USER="${SERVERLESS_ATLAS_USER}" - export SERVERLESS_ATLAS_PASSWORD="${SERVERLESS_ATLAS_PASSWORD}" EOT # See what we've done @@ -361,17 +349,6 @@ functions: script: | rm -f .env.private - "build and test docker image": - - command: shell.exec - type: test - params: - shell: bash - working_dir: "src" - script: | - ${PREPARE_SHELL} - set -x - .evergreen/test-on-docker -d ${os} MONGODB_VERSION=${mongodb-version} TOPOLOGY=${topology} RVM_RUBY=${ruby} -s .evergreen/run-tests.sh TEST_CMD=true ${PRELOAD_ARG} - "run benchmarks": - command: shell.exec type: test @@ -402,23 +379,6 @@ functions: fi .evergreen/run-tests.sh - "run tests via docker": - - command: shell.exec - type: test - params: - shell: bash - working_dir: "src" - script: | - ${PREPARE_SHELL} - # Needed for generating temporary aws credentials. - if [ -n "${FLE}" ]; - then - export AWS_ACCESS_KEY_ID="${fle_aws_key}" - export AWS_SECRET_ACCESS_KEY="${fle_aws_secret}" - export AWS_DEFAULT_REGION="${fle_aws_region}" - fi - .evergreen/run-tests-docker.sh - "run AWS auth tests": - command: shell.exec type: test @@ -439,16 +399,6 @@ functions: ${PREPARE_SHELL} .evergreen/run-tests-kerberos-unit.sh - "run Kerberos integration tests": - - command: shell.exec - type: test - params: - shell: bash - working_dir: "src" - script: | - ${PREPARE_SHELL} - .evergreen/run-tests-kerberos-integration.sh - "run Atlas tests": - command: shell.exec type: test @@ -468,24 +418,6 @@ functions: ATLAS_X509_DEV_URI="${atlas_x509_dev}" \ .evergreen/run-tests-atlas.sh - "run serverless tests": - - command: shell.exec - type: test - params: - shell: bash - working_dir: "src" - script: | - ${PREPARE_SHELL} - # Needed for generating temporary aws credentials. - if [ -n "${FLE}" ]; - then - export AWS_ACCESS_KEY_ID="${fle_aws_key}" - export AWS_SECRET_ACCESS_KEY="${fle_aws_secret}" - export AWS_DEFAULT_REGION="${fle_aws_region}" - fi - - CRYPT_SHARED_LIB_PATH="${CRYPT_SHARED_LIB_PATH}" SERVERLESS=1 SSL=ssl RVM_RUBY="${RVM_RUBY}" SINGLE_MONGOS="${SINGLE_MONGOS}" SERVERLESS_URI="${SERVERLESS_URI}" FLE="${FLE}" SERVERLESS_MONGODB_VERSION="${SERVERLESS_MONGODB_VERSION}" .evergreen/run-tests-serverless.sh - pre: - func: "fetch source" - func: "create expansions" @@ -499,35 +431,6 @@ post: - func: "upload test results to s3" task_groups: - - name: serverless_task_group - setup_group_can_fail_task: true - setup_group_timeout_secs: 1800 # 30 minutes - setup_group: - - func: "fetch source" - - func: "create expansions" - - command: ec2.assume_role - params: - role_arn: ${aws_test_secrets_role} - - command: shell.exec - params: - shell: "bash" - script: | - ${PREPARE_SHELL} - bash ${DRIVERS_TOOLS}/.evergreen/serverless/setup-secrets.sh - bash ${DRIVERS_TOOLS}/.evergreen/serverless/create-instance.sh - - command: expansions.update - params: - file: serverless-expansion.yml - teardown_task: - - command: shell.exec - params: - script: | - ${PREPARE_SHELL} - bash ${DRIVERS_TOOLS}/.evergreen/serverless/delete-instance.sh - - func: "upload test results" - tasks: - - "test-serverless" - - name: testatlas_full_task_group setup_group_can_fail_task: true setup_group_timeout_secs: 1800 # 30 minutes @@ -713,26 +616,12 @@ tasks: - name: "test-atlas" commands: - func: "run Atlas tests" - - name: "test-serverless" - commands: - - func: "export FLE credentials" - - func: "run serverless tests" - - name: "test-docker" - commands: - - func: "build and test docker image" - name: "test-mlaunch" commands: - func: "run tests" - name: "driver-bench" commands: - func: "run benchmarks" - - name: "test-via-docker" - commands: - - func: "run tests via docker" - - name: "test-kerberos-integration" - commands: - - func: "export Kerberos credentials" - - func: "run Kerberos integration tests" - name: "test-kerberos" commands: - func: "run Kerberos unit tests" @@ -743,10 +632,6 @@ tasks: commands: - func: "export FLE credentials" - func: "run tests" - - name: "test-fle-via-docker" - commands: - - func: "export FLE credentials" - - func: "run tests via docker" - name: "test-aws-auth" commands: - func: "export AWS auth credentials" diff --git a/.evergreen/run-tests-atlas-full.sh b/.evergreen/run-tests-atlas-full.sh index 2fb15001c1..c292d73c82 100755 --- a/.evergreen/run-tests-atlas-full.sh +++ b/.evergreen/run-tests-atlas-full.sh @@ -13,7 +13,7 @@ set_env_ruby bundle_install ATLAS_URI=$MONGODB_URI \ - SERVERLESS=1 \ + KILL_ALL_SERVER_SESSIONS=0 \ EXAMPLE_TIMEOUT=600 \ bundle exec rspec -fd spec/integration/search_indexes_prose_spec.rb diff --git a/spec/runners/crud.rb b/spec/runners/crud.rb index b0a76b5aca..98c16cdce6 100644 --- a/spec/runners/crud.rb +++ b/spec/runners/crud.rb @@ -224,14 +224,12 @@ def define_spec_tests_with_requirements(spec, &block) if req.topologies require_topology *req.topologies end - if SpecConfig.instance.serverless? && req.serverless == :forbid - before(:all) do - skip "Serverless forbidden" - end - end - if !SpecConfig.instance.serverless? && req.serverless == :require + + # Once `serverless: require` is no longer present in any specs, + # this can be removed. + if req.serverless == :require before(:all) do - skip "Serverless required" + skip 'Serverless tests are no longer enabled, per RUBY-3652' end end diff --git a/spec/runners/crud/requirement.rb b/spec/runners/crud/requirement.rb index 641de1ef75..29504f7a58 100644 --- a/spec/runners/crud/requirement.rb +++ b/spec/runners/crud/requirement.rb @@ -4,7 +4,7 @@ module Mongo module CRUD class Requirement - YAML_KEYS = %w(auth minServerVersion maxServerVersion topology topologies serverParameters serverless csfle).freeze + YAML_KEYS = %w(auth minServerVersion maxServerVersion topology topologies serverParameters csfle).freeze def initialize(spec) spec = spec.dup @@ -38,16 +38,6 @@ def initialize(spec) nil end @server_parameters = spec['serverParameters'] - @serverless = if serverless = spec['serverless'] - case spec['serverless'] - when 'require' then :require - when 'forbid' then :forbid - when 'allow' then :allow - else raise "Unknown serverless requirement: #{serverless}" - end - else - nil - end @auth = spec['auth'] @csfle = !!spec['csfle'] if spec['csfle'] end @@ -55,7 +45,45 @@ def initialize(spec) attr_reader :min_server_version attr_reader :max_server_version attr_reader :topologies - attr_reader :serverless + + # `serverless` is a deprecated field. This module is a crutch to help + # us through the transition period where some specs still have it. + module DeprecatedServerless + def self.prepended(base) + new_list = [ *base::YAML_KEYS, 'serverless' ].freeze + + base.send(:remove_const, :YAML_KEYS) + base.send(:const_set, :YAML_KEYS, new_list) + end + + attr_reader :serverless + + def initialize(spec) + super + initialize_serverless(spec) + end + + private + + def initialize_serverless(spec) + @serverless = if serverless = spec['serverless'] + case spec['serverless'] + when 'require' then :require + when 'forbid' then :forbid + when 'allow' then :allow + else raise "Unknown serverless requirement: #{serverless}" + end + else + nil + end + + if @serverless && @serverless != :forbid + warn "The `serverless` requirement is deprecated." + end + end + end + + prepend DeprecatedServerless def short_min_server_version if min_server_version @@ -101,13 +129,6 @@ def satisfied? end end end - if @serverless - if SpecConfig.instance.serverless? - ok = ok && [:allow, :require].include?(serverless) - else - ok = ok && [:allow, :forbid].include?(serverless) - end - end if @auth == true ok &&= SpecConfig.instance.auth? elsif @auth == false diff --git a/spec/runners/unified/test.rb b/spec/runners/unified/test.rb index 32b0ba0a82..775b0782ae 100644 --- a/spec/runners/unified/test.rb +++ b/spec/runners/unified/test.rb @@ -556,8 +556,6 @@ def kill_sessions # drivers-atlas-testing, ignore. SERVER-54216 elsif e.code == 59 # no such command (old server), ignore - elsif e.code == 8000 - # CMD_NOT_ALLOWED: killAllSessions - running against a serverless instance else raise end diff --git a/spec/support/spec_config.rb b/spec/support/spec_config.rb index 34d6c6d478..20588c1aa4 100644 --- a/spec/support/spec_config.rb +++ b/spec/support/spec_config.rb @@ -162,19 +162,9 @@ def ocsp_connectivity? ENV.key?('OCSP_CONNECTIVITY') && ENV['OCSP_CONNECTIVITY'] != '' end - # Detect whether specs are running against Mongodb Atlas serverless instance. - # This method does not do any magic, it just checks whether environment - # variable SERVERLESS is set. This is a recommended way to inform spec runners - # that they are running against a serverless instance - # - # @return [ true | false ] Whether specs are running against a serverless instance. - def serverless? - !!ENV['SERVERLESS'] - end - def kill_all_server_sessions? - !serverless? && # Serverless instances do not support killAllSessions command. - ClusterConfig.instance.fcv_ish >= '3.6' + allow = ENV['KILL_ALL_SERVER_SESSIONS'] != '0' + allow && ClusterConfig.instance.fcv_ish >= '3.6' end # Test suite configuration @@ -670,10 +660,6 @@ def root_user # Get the default test user for the suite on versions 2.6 and higher. def test_user - # When testing against a serverless instance, we are not allowed to create - # new users, we just have one user for everyhing. - return root_user if serverless? - Mongo::Auth::User.new( database: 'admin', user: 'ruby-test-user', @@ -764,4 +750,14 @@ def credentials_or_external_user(creds) def single_mongos? %w(1 true yes).include?(ENV['SINGLE_MONGOS']) end + + # serverless is deprecated, but it still gets called from some places + # (see Mrss::Constraints), etc. + module DeprecatedServerless + def serverless? + false + end + end + + prepend DeprecatedServerless end