diff --git a/.evergreen/config.yml b/.evergreen/config.yml index 7db7bc4ea7..67736ea4dc 100644 --- a/.evergreen/config.yml +++ b/.evergreen/config.yml @@ -467,65 +467,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: serverless_next_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 serverless_next - 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/setup-secrets.sh serverless_next - bash ${DRIVERS_TOOLS}/.evergreen/serverless/delete-instance.sh - - func: "upload test results" - tasks: - - "test-serverless" - - name: testatlas_task_group setup_group_can_fail_task: true setup_group_timeout_secs: 1800 # 30 minutes @@ -755,26 +696,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" @@ -782,10 +709,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" @@ -1081,15 +1004,15 @@ axes: - id: ubuntu2204 display_name: "Ubuntu 22.04" run_on: ubuntu2204-small + - id: ubuntu2204-arm + display_name: "Ubuntu 22.04 ARM" + run_on: ubuntu2204-arm64-small - id: ubuntu2004 display_name: "Ubuntu 20.04" run_on: ubuntu2004-small - - id: rhel8 - display_name: "RHEL 8" - run_on: rhel80-small - - id: rhel8-arm - display_name: "RHEL 8 ARM64" - run_on: rhel82-arm64-small + - id: ubuntu1804 + display_name: "Ubuntu 18.04" + run_on: ubuntu1804-small - id: docker-distro display_name: Docker Distro @@ -1196,7 +1119,7 @@ axes: values: - id: mmapv1 display_name: MMAPv1 - run_on: rhel80-small + run_on: ubuntu1804-small variables: MMAPV1: 'true' @@ -1302,7 +1225,7 @@ buildvariants: ruby: "ruby-3.2" mongodb-version: "7.0" topology: standalone - run_on: rhel80-large + os: ubuntu2204 display_name: DriverBench tasks: - name: "driver-bench" @@ -1311,9 +1234,9 @@ buildvariants: matrix_spec: auth-and-ssl: ["auth-and-ssl", "noauth-and-nossl"] ruby: "ruby-3.2" - mongodb-version: ["latest", "7.0", "6.0"] + mongodb-version: ["7.0", "6.0"] topology: ["standalone", "replica-set", "sharded-cluster"] - os: rhel8 + os: ubuntu2204 display_name: ${auth-and-ssl} ${ruby} db-${mongodb-version} ${topology} tasks: - name: "test-mlaunch" @@ -1321,32 +1244,30 @@ buildvariants: - matrix_name: "mongo-recent" matrix_spec: ruby: ["ruby-3.2", "ruby-3.1", "jruby-9.4"] - mongodb-version: ["latest", "7.0", "6.0"] + mongodb-version: ["7.0", "6.0"] topology: ["standalone", "replica-set", "sharded-cluster"] - os: ['rhel8'] - # There is no latest for ubuntu2204, so we can't test it here. - # os: ['rhel8', 'ubuntu2204'] - display_name: "${mongodb-version} ${os} ${topology} ${auth-and-ssl} ${ruby}" + os: ubuntu2204 + display_name: "${mongodb-version} ${os} ${topology} ${ruby}" tasks: - name: "test-mlaunch" - matrix_name: "mongo-recent-arm" matrix_spec: ruby: "ruby-3.2" - mongodb-version: ["latest", "7.0", "6.0"] + mongodb-version: ["7.0", "6.0"] topology: ["standalone", "replica-set", "sharded-cluster"] - os: 'rhel8-arm' - display_name: "${mongodb-version} ${os} ${topology} ${auth-and-ssl} ${ruby}" + os: ubuntu2204-arm + display_name: "${mongodb-version} ${os} ${topology} ${ruby}" tasks: - name: "test-mlaunch" - matrix_name: "mongo-5.x" matrix_spec: ruby: ["ruby-3.2", "ruby-2.7", "jruby-9.4"] - mongodb-version: ['5.3', '5.0'] + mongodb-version: '5.0' topology: ["standalone", "replica-set", "sharded-cluster"] - os: rhel8 - display_name: "${mongodb-version} ${topology} ${auth-and-ssl} ${ruby}" + os: ubuntu1804 + display_name: "${mongodb-version} ${topology} ${ruby}" tasks: - name: "test-mlaunch" @@ -1355,8 +1276,8 @@ buildvariants: ruby: ["ruby-3.0", "ruby-2.7"] mongodb-version: ['4.4', '4.2', '4.0'] topology: ["standalone", "replica-set", "sharded-cluster"] - os: rhel8 - display_name: "${mongodb-version} ${topology} ${auth-and-ssl} ${ruby}" + os: ubuntu1804 + display_name: "${mongodb-version} ${topology} ${ruby}" tasks: - name: "test-mlaunch" @@ -1365,8 +1286,8 @@ buildvariants: ruby: "ruby-2.7" mongodb-version: ['3.6'] topology: ["standalone", "replica-set", "sharded-cluster"] - os: rhel8 - display_name: "${mongodb-version} ${topology} ${auth-and-ssl} ${ruby}" + os: ubuntu1804 + display_name: "${mongodb-version} ${topology} ${ruby}" tasks: - name: "test-mlaunch" @@ -1376,19 +1297,19 @@ buildvariants: mongodb-version: "7.0" topology: load-balanced single-mongos: single-mongos - os: rhel8 - display_name: "${mongodb-version} ${topology} single-lb ${auth-and-ssl} ${ruby}" + os: ubuntu2204 + display_name: "${mongodb-version} ${topology} single-lb ${ruby}" tasks: - name: "test-mlaunch" - - matrix_name: "mongo-5.0-api-version" + - matrix_name: "mongo-api-version" matrix_spec: ruby: "ruby-3.2" - mongodb-version: '5.0' + mongodb-version: '7.0' topology: standalone api-version-required: yes - os: rhel8 - display_name: "${mongodb-version} api-version-required ${topology} ${auth-and-ssl} ${ruby}" + os: ubuntu2204 + display_name: "${mongodb-version} api-version-required ${topology} ${ruby}" tasks: - name: "test-mlaunch" @@ -1398,8 +1319,8 @@ buildvariants: mongodb-version: "7.0" topology: "sharded-cluster" single-mongos: single-mongos - os: rhel8 - display_name: "${mongodb-version} ${topology} single-mongos ${auth-and-ssl} ${ruby}" + os: ubuntu2204 + display_name: "${mongodb-version} ${topology} single-mongos ${ruby}" tasks: - name: "test-mlaunch" @@ -1409,7 +1330,7 @@ buildvariants: ruby: "ruby-3.2" mongodb-version: "7.0" topology: ["standalone", "replica-set", "sharded-cluster"] - os: rhel8 + os: ubuntu2204 display_name: "${mongodb-version} ${topology} ${retry-reads} ${ruby}" tasks: - name: "test-mlaunch" @@ -1420,7 +1341,7 @@ buildvariants: ruby: "ruby-3.2" mongodb-version: "7.0" topology: [replica-set, sharded-cluster] - os: rhel8 + os: ubuntu2204 display_name: "${mongodb-version} ${topology} ${retry-writes} ${ruby}" tasks: - name: "test-mlaunch" @@ -1431,7 +1352,7 @@ buildvariants: mongodb-version: ['3.6', '4.0'] topology: ["standalone", "replica-set", "sharded-cluster"] storage-engine: mmapv1 - os: rhel8 + os: ubuntu1804 display_name: "${mongodb-version} ${topology} mmapv1 ${ruby}" tasks: - name: "test-mlaunch" @@ -1442,7 +1363,7 @@ buildvariants: ruby: "ruby-3.2" mongodb-version: "7.0" topology: '*' - os: rhel8 + os: ubuntu2204 display_name: "${mongodb-version} ${topology} ${lint} ${ruby}" tasks: - name: "test-mlaunch" @@ -1453,7 +1374,7 @@ buildvariants: ruby: "ruby-3.2" mongodb-version: "7.0" topology: ["standalone", "replica-set", "sharded-cluster"] - os: rhel8 + os: ubuntu2204 display_name: "${mongodb-version} ${topology} fork ${ruby}" tasks: - name: "test-mlaunch" @@ -1464,7 +1385,7 @@ buildvariants: ruby: ["ruby-3.2", "ruby-3.1", "ruby-3.0", "ruby-2.7", "jruby-9.4", "jruby-9.3"] mongodb-version: "7.0" topology: ["standalone", "replica-set", "sharded-cluster"] - os: rhel8 + os: ubuntu2004 display_name: "${mongodb-version} ${topology} solo ${ruby}" tasks: - name: "test-mlaunch" @@ -1475,7 +1396,7 @@ buildvariants: ruby: ["ruby-2.7"] mongodb-version: ['4.2', '4.0', '3.6'] topology: replica-set - os: rhel8 + os: ubuntu1804 display_name: "${mongodb-version} ${topology} stress ${ruby}" tasks: - name: "test-mlaunch" @@ -1484,9 +1405,9 @@ buildvariants: matrix_spec: stress: on ruby: "ruby-3.2" - mongodb-version: ["6.0", "5.3"] + mongodb-version: ["6.0", "5.0"] topology: replica-set - os: rhel8 + os: ubuntu2004 display_name: "${mongodb-version} ${topology} stress ${ruby}" tasks: - name: "test-mlaunch" @@ -1495,14 +1416,9 @@ buildvariants: matrix_spec: auth-and-ssl: "x509" ruby: "ruby-3.2" - # 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: rhel8 + os: ubuntu2204 display_name: "${mongodb-version} ${topology} ${auth-and-ssl} ${ruby}" tasks: - name: "test-mlaunch" @@ -1513,7 +1429,7 @@ buildvariants: ruby: jruby-9.4 mongodb-version: "7.0" topology: ["standalone", "replica-set", "sharded-cluster"] - os: rhel8 + os: ubuntu2204 display_name: "${mongodb-version} ${topology} ${auth-and-ssl} ${ruby}" tasks: - name: "test-mlaunch" @@ -1525,7 +1441,7 @@ buildvariants: mongodb-version: "7.0" topology: "replica-set" compressor: 'zlib' - os: rhel8 + os: ubuntu2004 display_name: "${compressor} ${mongodb-version} ${topology} ${auth-and-ssl} ${ruby}" tasks: - name: "test-mlaunch" @@ -1537,7 +1453,7 @@ buildvariants: mongodb-version: "7.0" topology: "replica-set" compressor: 'snappy' - os: rhel8 + os: ubuntu2004 display_name: "${compressor} ${mongodb-version} ${topology} ${auth-and-ssl} ${ruby}" tasks: - name: "test-mlaunch" @@ -1553,7 +1469,7 @@ buildvariants: mongodb-version: "7.0" topology: "replica-set" compressor: 'zstd' - os: rhel8 + os: ubuntu2004 display_name: "${compressor} ${mongodb-version} ${topology} ${auth-and-ssl} ${ruby}" tasks: - name: "test-mlaunch" @@ -1564,7 +1480,7 @@ buildvariants: mongodb-version: "7.0" topology: replica-set as: as - os: rhel8 + os: ubuntu2004 display_name: "AS ${mongodb-version} ${topology} ${ruby}" tasks: - name: "test-mlaunch" @@ -1575,50 +1491,29 @@ buildvariants: mongodb-version: "7.0" topology: replica-set bson: "*" - os: rhel8 + os: ubuntu2004 display_name: "bson-${bson} ${mongodb-version} ${topology} ${ruby}" tasks: - name: "test-mlaunch" - # kerberos integration tests are broken (RUBY-3266) - # - matrix_name: "kerberos-integration" - # matrix_spec: - # ruby: ["ruby-3.2", "ruby-2.7", "jruby-9.4"] - # os: rhel8 - # display_name: "Kerberos integration ${os} ${ruby}" - # tasks: - # - name: "test-kerberos-integration" - - matrix_name: "kerberos-unit" matrix_spec: ruby: "ruby-3.2" mongodb-version: "7.0" topology: standalone - os: rhel8 + os: ubuntu2204 auth-and-ssl: kerberos display_name: "Kerberos Tests" tasks: - name: "test-kerberos" - - matrix_name: "fle-latest" - matrix_spec: - auth-and-ssl: "noauth-and-nossl" - ruby: "ruby-3.2" - topology: [replica-set, sharded-cluster] - mongodb-version: [ 'latest', '7.0' ] - os: rhel8 - fle: helper - display_name: "FLE: ${mongodb-version} ${topology} ${ruby}" - tasks: - - name: "test-fle" - - matrix_name: "fle" matrix_spec: auth-and-ssl: "noauth-and-nossl" - ruby: ["ruby-3.2", "ruby-2.7"] + ruby: "ruby-3.2" topology: [replica-set, sharded-cluster] - mongodb-version: [ '6.0', '4.4', '4.2', '4.0' ] - os: rhel8 + mongodb-version: [ '6.0', '7.0' ] + os: ubuntu2204 fle: helper display_name: "FLE: ${mongodb-version} ${topology} ${ruby}" tasks: @@ -1636,7 +1531,7 @@ buildvariants: # 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: "5.0" os: ubuntu2004 display_name: "AWS ${auth-and-ssl} ${mongodb-version} ${ruby}" tasks: @@ -1649,7 +1544,7 @@ buildvariants: ruby: ["ruby-3.2", "ruby-3.1", "ruby-3.0", "ruby-2.7"] topology: standalone mongodb-version: "7.0" - os: rhel8 + os: ubuntu2004 display_name: "OCSP verifier: ${mongodb-version} ${ruby}" tasks: - name: test-mlaunch @@ -1662,7 +1557,7 @@ buildvariants: ruby: ["ruby-3.2", "ruby-2.7"] topology: standalone mongodb-version: "7.0" - os: rhel8 + os: ubuntu2004 auth-and-ssl: noauth-and-ssl display_name: "OCSP integration - must staple: ${mongodb-version} ${ruby}" tasks: @@ -1675,7 +1570,7 @@ buildvariants: ruby: ["ruby-3.2", "ruby-2.7"] topology: standalone mongodb-version: "7.0" - os: rhel8 + os: ubuntu2004 auth-and-ssl: noauth-and-ssl display_name: "OCSP integration - unknown: ${mongodb-version} ${ruby}" tasks: @@ -1691,7 +1586,7 @@ buildvariants: ruby: ["ruby-3.2", "ruby-2.7"] topology: standalone mongodb-version: "7.0" - os: rhel8 + os: ubuntu2004 display_name: "OCSP connectivity: ${ocsp-algorithm} ${ocsp-status} ${ocsp-delegate} ${extra-uri-options} ${mongodb-version} ${ruby}" tasks: - name: test-mlaunch @@ -1705,7 +1600,7 @@ buildvariants: ruby: ["ruby-3.2", "ruby-2.7"] topology: standalone mongodb-version: "7.0" - os: rhel8 + os: ubuntu2004 display_name: "OCSP connectivity: ${ocsp-algorithm} ${ocsp-status} ${ocsp-delegate} ${extra-uri-options} ${mongodb-version} ${ruby}" tasks: - name: test-mlaunch @@ -1719,7 +1614,7 @@ buildvariants: ruby: ["ruby-3.2", "ruby-2.7"] topology: standalone mongodb-version: "7.0" - os: rhel8 + os: ubuntu2004 display_name: "OCSP connectivity: ${ocsp-algorithm} ${ocsp-status} ${ocsp-delegate} ${extra-uri-options} ${mongodb-version} ${ruby}" tasks: - name: test-mlaunch @@ -1733,7 +1628,7 @@ buildvariants: ruby: ["ruby-3.2", "ruby-2.7"] topology: standalone mongodb-version: "7.0" - os: rhel8 + os: ubuntu2004 display_name: "OCSP connectivity: ${ocsp-algorithm} ${ocsp-status} ${ocsp-delegate} ${extra-uri-options} ${mongodb-version} ${ruby}" tasks: - name: test-mlaunch @@ -1747,7 +1642,7 @@ buildvariants: ruby: ["ruby-3.2", "ruby-2.7"] topology: standalone mongodb-version: "7.0" - os: rhel8 + os: ubuntu2004 display_name: "OCSP connectivity: ${ocsp-algorithm} ${ocsp-status} ${ocsp-delegate} ${extra-uri-options} ${mongodb-version} ${ruby}" tasks: - name: test-mlaunch @@ -1761,7 +1656,7 @@ buildvariants: ruby: ["ruby-3.2", "ruby-2.7"] topology: standalone mongodb-version: "7.0" - os: rhel8 + os: ubuntu2004 display_name: "OCSP connectivity: ${ocsp-algorithm} ${ocsp-status} ${ocsp-delegate} ${extra-uri-options} ${mongodb-version} ${ruby}" tasks: - name: test-mlaunch @@ -1775,7 +1670,7 @@ buildvariants: ruby: ["ruby-3.2", "ruby-2.7"] topology: standalone mongodb-version: "7.0" - os: rhel8 + os: ubuntu2004 display_name: "OCSP connectivity: ${ocsp-algorithm} ${ocsp-status} ${ocsp-delegate} ${extra-uri-options} ${mongodb-version} ${ruby}" tasks: - name: test-mlaunch @@ -1789,7 +1684,7 @@ buildvariants: ruby: ["ruby-3.2", "ruby-2.7"] topology: standalone mongodb-version: "7.0" - os: rhel8 + os: ubuntu2004 display_name: "OCSP connectivity: ${ocsp-algorithm} ${ocsp-status} ${ocsp-delegate} ${extra-uri-options} ${mongodb-version} ${ruby}" tasks: - name: test-mlaunch @@ -1803,7 +1698,7 @@ buildvariants: ruby: ["ruby-3.2", "ruby-2.7"] topology: standalone mongodb-version: "7.0" - os: rhel8 + os: ubuntu2004 display_name: "OCSP connectivity: ${ocsp-algorithm} ${ocsp-status} ${ocsp-delegate} ${extra-uri-options} ${mongodb-version} ${ruby}" tasks: - name: test-mlaunch @@ -1823,7 +1718,7 @@ buildvariants: ruby: jruby-9.4 topology: standalone mongodb-version: "7.0" - os: rhel8 + os: ubuntu2204 display_name: "OCSP connectivity: ${ocsp-algorithm} ${ocsp-status} ${ocsp-delegate} ${mongodb-version} ${ruby}" tasks: - name: test-mlaunch @@ -1833,7 +1728,7 @@ buildvariants: ruby: "ruby-3.2" fle: helper topology: standalone - os: rhel8 + os: ubuntu2204 mongodb-version: "7.0" display_name: "GCP KMS" tasks: @@ -1855,7 +1750,7 @@ buildvariants: - matrix_name: atlas-full matrix_spec: ruby: "ruby-3.2" - os: rhel8 + os: ubuntu2204 display_name: "Atlas (Full)" tasks: - name: testatlas_full_task_group @@ -1863,37 +1758,14 @@ buildvariants: - matrix_name: "atlas" matrix_spec: ruby: ["ruby-3.2", "ruby-3.1", "ruby-3.0", "ruby-2.7", "jruby-9.4", "jruby-9.3"] - os: rhel8 + os: ubuntu2004 display_name: "Atlas tests ${ruby}" tasks: - name: testatlas_task_group -# Commented out, pending RUBY-3414 -# - matrix_name: "serverless" -# matrix_spec: -# # https://jira.mongodb.org/browse/RUBY-3217 -# # ruby: ["ruby-3.2", "ruby-3.1", "ruby-3.0", "ruby-2.7", "jruby-9.4", "jruby-9.3"] -# ruby: ["ruby-3.2", "ruby-3.1", "ruby-3.0", "ruby-2.7"] -# fle: path -# os: rhel8 -# display_name: "Atlas serverless ${ruby}" -# tasks: -# - name: serverless_task_group -# -# - matrix_name: "serverless-next" -# matrix_spec: -# # https://jira.mongodb.org/browse/RUBY-3217 -# # ruby: ["ruby-3.2", "ruby-3.1", "ruby-3.0", "ruby-2.7", "jruby-9.4", "jruby-9.3"] -# ruby: ["ruby-3.2", "ruby-3.1", "ruby-3.0", "ruby-2.7"] -# fle: path -# os: rhel8 -# display_name: "Atlas serverless-next ${ruby}" -# tasks: -# - name: serverless_next_task_group - - matrix_name: "aws-lambda" matrix_spec: - ruby: "ruby-3.2" + ruby: 'ruby-3.2' os: ubuntu2204 display_name: "AWS Lambda" tasks: diff --git a/.evergreen/config/axes.yml.erb b/.evergreen/config/axes.yml.erb index c433cf9c22..4b2da7ab10 100644 --- a/.evergreen/config/axes.yml.erb +++ b/.evergreen/config/axes.yml.erb @@ -184,15 +184,15 @@ axes: - id: ubuntu2204 display_name: "Ubuntu 22.04" run_on: ubuntu2204-small + - id: ubuntu2204-arm + display_name: "Ubuntu 22.04 ARM" + run_on: ubuntu2204-arm64-small - id: ubuntu2004 display_name: "Ubuntu 20.04" run_on: ubuntu2004-small - - id: rhel8 - display_name: "RHEL 8" - run_on: rhel80-small - - id: rhel8-arm - display_name: "RHEL 8 ARM64" - run_on: rhel82-arm64-small + - id: ubuntu1804 + display_name: "Ubuntu 18.04" + run_on: ubuntu1804-small - id: docker-distro display_name: Docker Distro @@ -297,7 +297,7 @@ axes: values: - id: mmapv1 display_name: MMAPv1 - run_on: rhel80-small + run_on: ubuntu1804-small variables: MMAPV1: 'true' diff --git a/.evergreen/config/common.yml.erb b/.evergreen/config/common.yml.erb index cacba6b5aa..19cddacaca 100644 --- a/.evergreen/config/common.yml.erb +++ b/.evergreen/config/common.yml.erb @@ -464,65 +464,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: serverless_next_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 serverless_next - 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/setup-secrets.sh serverless_next - bash ${DRIVERS_TOOLS}/.evergreen/serverless/delete-instance.sh - - func: "upload test results" - tasks: - - "test-serverless" - - name: testatlas_task_group setup_group_can_fail_task: true setup_group_timeout_secs: 1800 # 30 minutes @@ -752,26 +693,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" @@ -779,10 +706,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/standard.yml.erb b/.evergreen/config/standard.yml.erb index 668e65a9b1..53bf417758 100644 --- a/.evergreen/config/standard.yml.erb +++ b/.evergreen/config/standard.yml.erb @@ -29,10 +29,10 @@ latest_stable_mdb = "7.0".inspect # so it gets quoted as a string # A few of the most recent MongoDB versions - actual_and_upcoming_mdb = %w( latest 7.0 6.0 ) + actual_and_upcoming_mdb = %w( 7.0 6.0 ) - recent_mdb = %w( 6.0 5.3 ) - latest_5x_mdb = "5.3".inspect # so it gets quoted as a string + recent_mdb = %w( 6.0 5.0 ) + latest_5x_mdb = "5.0".inspect # so it gets quoted as a string %> buildvariants: @@ -41,7 +41,7 @@ buildvariants: ruby: <%= latest_ruby %> mongodb-version: <%= latest_stable_mdb %> topology: standalone - run_on: rhel80-large + os: ubuntu2204 display_name: DriverBench tasks: - name: "driver-bench" @@ -52,7 +52,7 @@ buildvariants: ruby: <%= latest_ruby %> mongodb-version: <%= actual_and_upcoming_mdb %> topology: <%= topologies %> - os: rhel8 + os: ubuntu2204 display_name: ${auth-and-ssl} ${ruby} db-${mongodb-version} ${topology} tasks: - name: "test-mlaunch" @@ -62,10 +62,8 @@ buildvariants: ruby: <%= recent_rubies %> mongodb-version: <%= actual_and_upcoming_mdb %> topology: <%= topologies %> - os: ['rhel8'] - # There is no latest for ubuntu2204, so we can't test it here. - # os: ['rhel8', 'ubuntu2204'] - display_name: "${mongodb-version} ${os} ${topology} ${auth-and-ssl} ${ruby}" + os: ubuntu2204 + display_name: "${mongodb-version} ${os} ${topology} ${ruby}" tasks: - name: "test-mlaunch" @@ -74,18 +72,18 @@ buildvariants: ruby: <%= latest_ruby %> mongodb-version: <%= actual_and_upcoming_mdb %> topology: <%= topologies %> - os: 'rhel8-arm' - display_name: "${mongodb-version} ${os} ${topology} ${auth-and-ssl} ${ruby}" + os: ubuntu2204-arm + display_name: "${mongodb-version} ${os} ${topology} ${ruby}" tasks: - name: "test-mlaunch" - matrix_name: "mongo-5.x" matrix_spec: ruby: <%= sample_rubies %> - mongodb-version: ['5.3', '5.0'] + mongodb-version: '5.0' topology: <%= topologies %> - os: rhel8 - display_name: "${mongodb-version} ${topology} ${auth-and-ssl} ${ruby}" + os: ubuntu1804 + display_name: "${mongodb-version} ${topology} ${ruby}" tasks: - name: "test-mlaunch" @@ -94,8 +92,8 @@ buildvariants: ruby: <%= older_rubies %> mongodb-version: ['4.4', '4.2', '4.0'] topology: <%= topologies %> - os: rhel8 - display_name: "${mongodb-version} ${topology} ${auth-and-ssl} ${ruby}" + os: ubuntu1804 + display_name: "${mongodb-version} ${topology} ${ruby}" tasks: - name: "test-mlaunch" @@ -104,8 +102,8 @@ buildvariants: ruby: "ruby-2.7" mongodb-version: ['3.6'] topology: <%= topologies %> - os: rhel8 - display_name: "${mongodb-version} ${topology} ${auth-and-ssl} ${ruby}" + os: ubuntu1804 + display_name: "${mongodb-version} ${topology} ${ruby}" tasks: - name: "test-mlaunch" @@ -115,19 +113,19 @@ buildvariants: mongodb-version: <%= latest_stable_mdb %> topology: load-balanced single-mongos: single-mongos - os: rhel8 - display_name: "${mongodb-version} ${topology} single-lb ${auth-and-ssl} ${ruby}" + os: ubuntu2204 + display_name: "${mongodb-version} ${topology} single-lb ${ruby}" tasks: - name: "test-mlaunch" - - matrix_name: "mongo-5.0-api-version" + - matrix_name: "mongo-api-version" matrix_spec: ruby: <%= latest_ruby %> - mongodb-version: '5.0' + mongodb-version: '7.0' topology: standalone api-version-required: yes - os: rhel8 - display_name: "${mongodb-version} api-version-required ${topology} ${auth-and-ssl} ${ruby}" + os: ubuntu2204 + display_name: "${mongodb-version} api-version-required ${topology} ${ruby}" tasks: - name: "test-mlaunch" @@ -137,8 +135,8 @@ buildvariants: mongodb-version: <%= latest_stable_mdb %> topology: "sharded-cluster" single-mongos: single-mongos - os: rhel8 - display_name: "${mongodb-version} ${topology} single-mongos ${auth-and-ssl} ${ruby}" + os: ubuntu2204 + display_name: "${mongodb-version} ${topology} single-mongos ${ruby}" tasks: - name: "test-mlaunch" @@ -148,7 +146,7 @@ buildvariants: ruby: <%= latest_ruby %> mongodb-version: <%= latest_stable_mdb %> topology: <%= topologies %> - os: rhel8 + os: ubuntu2204 display_name: "${mongodb-version} ${topology} ${retry-reads} ${ruby}" tasks: - name: "test-mlaunch" @@ -159,7 +157,7 @@ buildvariants: ruby: <%= latest_ruby %> mongodb-version: <%= latest_stable_mdb %> topology: [replica-set, sharded-cluster] - os: rhel8 + os: ubuntu2204 display_name: "${mongodb-version} ${topology} ${retry-writes} ${ruby}" tasks: - name: "test-mlaunch" @@ -170,7 +168,7 @@ buildvariants: mongodb-version: ['3.6', '4.0'] topology: <%= topologies %> storage-engine: mmapv1 - os: rhel8 + os: ubuntu1804 display_name: "${mongodb-version} ${topology} mmapv1 ${ruby}" tasks: - name: "test-mlaunch" @@ -181,7 +179,7 @@ buildvariants: ruby: <%= latest_ruby %> mongodb-version: <%= latest_stable_mdb %> topology: '*' - os: rhel8 + os: ubuntu2204 display_name: "${mongodb-version} ${topology} ${lint} ${ruby}" tasks: - name: "test-mlaunch" @@ -192,7 +190,7 @@ buildvariants: ruby: <%= latest_ruby %> mongodb-version: <%= latest_stable_mdb %> topology: <%= topologies %> - os: rhel8 + os: ubuntu2204 display_name: "${mongodb-version} ${topology} fork ${ruby}" tasks: - name: "test-mlaunch" @@ -203,7 +201,7 @@ buildvariants: ruby: <%= supported_rubies %> mongodb-version: <%= latest_stable_mdb %> topology: <%= topologies %> - os: rhel8 + os: ubuntu2004 display_name: "${mongodb-version} ${topology} solo ${ruby}" tasks: - name: "test-mlaunch" @@ -214,7 +212,7 @@ buildvariants: ruby: ["ruby-2.7"] mongodb-version: ['4.2', '4.0', '3.6'] topology: replica-set - os: rhel8 + os: ubuntu1804 display_name: "${mongodb-version} ${topology} stress ${ruby}" tasks: - name: "test-mlaunch" @@ -225,7 +223,7 @@ buildvariants: ruby: <%= latest_ruby %> mongodb-version: <%= recent_mdb %> topology: replica-set - os: rhel8 + os: ubuntu2004 display_name: "${mongodb-version} ${topology} stress ${ruby}" tasks: - name: "test-mlaunch" @@ -234,14 +232,9 @@ buildvariants: matrix_spec: auth-and-ssl: "x509" ruby: <%= latest_ruby %> - # 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: rhel8 + os: ubuntu2204 display_name: "${mongodb-version} ${topology} ${auth-and-ssl} ${ruby}" tasks: - name: "test-mlaunch" @@ -252,7 +245,7 @@ buildvariants: ruby: <%= jrubies.first %> mongodb-version: <%= latest_stable_mdb %> topology: <%= topologies %> - os: rhel8 + os: ubuntu2204 display_name: "${mongodb-version} ${topology} ${auth-and-ssl} ${ruby}" tasks: - name: "test-mlaunch" @@ -264,7 +257,7 @@ buildvariants: mongodb-version: <%= latest_stable_mdb %> topology: "replica-set" compressor: 'zlib' - os: rhel8 + os: ubuntu2004 display_name: "${compressor} ${mongodb-version} ${topology} ${auth-and-ssl} ${ruby}" tasks: - name: "test-mlaunch" @@ -276,7 +269,7 @@ buildvariants: mongodb-version: <%= latest_stable_mdb %> topology: "replica-set" compressor: 'snappy' - os: rhel8 + os: ubuntu2004 display_name: "${compressor} ${mongodb-version} ${topology} ${auth-and-ssl} ${ruby}" tasks: - name: "test-mlaunch" @@ -292,7 +285,7 @@ buildvariants: mongodb-version: <%= latest_stable_mdb %> topology: "replica-set" compressor: 'zstd' - os: rhel8 + os: ubuntu2004 display_name: "${compressor} ${mongodb-version} ${topology} ${auth-and-ssl} ${ruby}" tasks: - name: "test-mlaunch" @@ -303,7 +296,7 @@ buildvariants: mongodb-version: <%= latest_stable_mdb %> topology: replica-set as: as - os: rhel8 + os: ubuntu2004 display_name: "AS ${mongodb-version} ${topology} ${ruby}" tasks: - name: "test-mlaunch" @@ -314,50 +307,29 @@ buildvariants: mongodb-version: <%= latest_stable_mdb %> topology: replica-set bson: "*" - os: rhel8 + os: ubuntu2004 display_name: "bson-${bson} ${mongodb-version} ${topology} ${ruby}" tasks: - name: "test-mlaunch" - # kerberos integration tests are broken (RUBY-3266) - # - matrix_name: "kerberos-integration" - # matrix_spec: - # ruby: <%= sample_rubies %> - # os: rhel8 - # display_name: "Kerberos integration ${os} ${ruby}" - # tasks: - # - name: "test-kerberos-integration" - - matrix_name: "kerberos-unit" matrix_spec: ruby: <%= latest_ruby %> mongodb-version: <%= latest_stable_mdb %> topology: standalone - os: rhel8 + os: ubuntu2204 auth-and-ssl: kerberos display_name: "Kerberos Tests" tasks: - name: "test-kerberos" - - matrix_name: "fle-latest" - matrix_spec: - auth-and-ssl: "noauth-and-nossl" - ruby: <%= latest_ruby %> - topology: [replica-set, sharded-cluster] - mongodb-version: [ 'latest', '7.0' ] - os: rhel8 - fle: helper - display_name: "FLE: ${mongodb-version} ${topology} ${ruby}" - tasks: - - name: "test-fle" - - matrix_name: "fle" matrix_spec: auth-and-ssl: "noauth-and-nossl" - ruby: <%= sample_mri_rubies %> + ruby: <%= latest_ruby %> topology: [replica-set, sharded-cluster] - mongodb-version: [ '6.0', '4.4', '4.2', '4.0' ] - os: rhel8 + mongodb-version: [ '6.0', '7.0' ] + os: ubuntu2204 fle: helper display_name: "FLE: ${mongodb-version} ${topology} ${ruby}" tasks: @@ -388,7 +360,7 @@ buildvariants: ruby: <%= supported_mri_rubies %> topology: standalone mongodb-version: <%= latest_stable_mdb %> - os: rhel8 + os: ubuntu2004 display_name: "OCSP verifier: ${mongodb-version} ${ruby}" tasks: - name: test-mlaunch @@ -401,7 +373,7 @@ buildvariants: ruby: <%= sample_mri_rubies %> topology: standalone mongodb-version: <%= latest_stable_mdb %> - os: rhel8 + os: ubuntu2004 auth-and-ssl: noauth-and-ssl display_name: "OCSP integration - must staple: ${mongodb-version} ${ruby}" tasks: @@ -414,7 +386,7 @@ buildvariants: ruby: <%= sample_mri_rubies %> topology: standalone mongodb-version: <%= latest_stable_mdb %> - os: rhel8 + os: ubuntu2004 auth-and-ssl: noauth-and-ssl display_name: "OCSP integration - unknown: ${mongodb-version} ${ruby}" tasks: @@ -444,7 +416,7 @@ buildvariants: ruby: <%= sample_mri_rubies %> topology: standalone mongodb-version: <%= latest_stable_mdb %> - os: rhel8 + os: ubuntu2004 display_name: "OCSP connectivity: ${ocsp-algorithm} ${ocsp-status} ${ocsp-delegate} ${extra-uri-options} ${mongodb-version} ${ruby}" tasks: - name: test-mlaunch @@ -465,7 +437,7 @@ buildvariants: ruby: <%= jrubies.first %> topology: standalone mongodb-version: <%= latest_stable_mdb %> - os: rhel8 + os: ubuntu2204 display_name: "OCSP connectivity: ${ocsp-algorithm} ${ocsp-status} ${ocsp-delegate} ${mongodb-version} ${ruby}" tasks: - name: test-mlaunch @@ -475,7 +447,7 @@ buildvariants: ruby: <%= latest_ruby %> fle: helper topology: standalone - os: rhel8 + os: ubuntu2204 mongodb-version: <%= latest_stable_mdb %> display_name: "GCP KMS" tasks: @@ -497,7 +469,7 @@ buildvariants: - matrix_name: atlas-full matrix_spec: ruby: <%= latest_ruby %> - os: rhel8 + os: ubuntu2204 display_name: "Atlas (Full)" tasks: - name: testatlas_full_task_group @@ -505,37 +477,14 @@ buildvariants: - matrix_name: "atlas" matrix_spec: ruby: <%= supported_rubies %> - os: rhel8 + os: ubuntu2004 display_name: "Atlas tests ${ruby}" tasks: - name: testatlas_task_group -# Commented out, pending RUBY-3414 -# - matrix_name: "serverless" -# matrix_spec: -# # https://jira.mongodb.org/browse/RUBY-3217 -# # ruby: <%= supported_rubies %> -# ruby: <%= supported_mri_rubies %> -# fle: path -# os: rhel8 -# display_name: "Atlas serverless ${ruby}" -# tasks: -# - name: serverless_task_group -# -# - matrix_name: "serverless-next" -# matrix_spec: -# # https://jira.mongodb.org/browse/RUBY-3217 -# # ruby: <%= supported_rubies %> -# ruby: <%= supported_mri_rubies %> -# fle: path -# os: rhel8 -# display_name: "Atlas serverless-next ${ruby}" -# tasks: -# - name: serverless_next_task_group - - matrix_name: "aws-lambda" matrix_spec: - ruby: <%= latest_ruby %> + ruby: 'ruby-3.2' os: ubuntu2204 display_name: "AWS Lambda" tasks: diff --git a/.evergreen/run-tests.sh b/.evergreen/run-tests.sh index a2203eb79a..6916698f31 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 @@ -110,7 +110,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 \ @@ -278,7 +278,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/.github/workflows/test.yml b/.github/workflows/test.yml index e3f468fe8b..eed6da1e33 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -3,7 +3,7 @@ # the standalone one. name: Run Driver Tests -on: [push, pull_request] +on: [ workflow_dispatch ] jobs: build: name: "${{matrix.os}} ruby-${{matrix.ruby}} mongodb-${{matrix.mongodb}} ${{matrix.topology}}" diff --git a/.gitmodules b/.gitmodules index 6d428f359d..366d171c3a 100644 --- a/.gitmodules +++ b/.gitmodules @@ -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 diff --git a/.mod/drivers-evergreen-tools b/.mod/drivers-evergreen-tools index 8c948a286f..9142b7055e 160000 --- a/.mod/drivers-evergreen-tools +++ b/.mod/drivers-evergreen-tools @@ -1 +1 @@ -Subproject commit 8c948a286f1b82427b5a409b8c42475b599d4d6f +Subproject commit 9142b7055ea5940e59ad41c4b069376f867031da diff --git a/lib/mongo/socket/ssl.rb b/lib/mongo/socket/ssl.rb index 10bb7b4d6c..747896b33f 100644 --- a/lib/mongo/socket/ssl.rb +++ b/lib/mongo/socket/ssl.rb @@ -23,6 +23,7 @@ class Socket # @since 2.0.0 class SSL < Socket include OpenSSL + include Loggable # Initializes a new TLS socket. # @@ -363,12 +364,15 @@ def verify_certificate!(socket) end def verify_ocsp_endpoint!(socket) - unless verify_ocsp_endpoint? - return - end + return unless verify_ocsp_endpoint? cert = socket.peer_cert - ca_cert = socket.peer_cert_chain.last + ca_cert = find_issuer(cert, socket.peer_cert_chain) + + unless ca_cert + log_warn("TLS certificate of '#{host_name}' could not be definitively verified via OCSP: issuer certificate not found in the chain.") + return + end verifier = OcspVerifier.new(@host_name, cert, ca_cert, context.cert_store, **Utils.shallow_symbolize_keys(options)) @@ -411,6 +415,11 @@ def extract_certs(text) end end end + + # Find the issuer certificate in the chain. + def find_issuer(cert, cert_chain) + cert_chain.find { |c| c.subject == cert.issuer } + end end end end diff --git a/profile/driver_bench/rake/tasks.rake b/profile/driver_bench/rake/tasks.rake index 7614a3a44c..44bcfb5049 100644 --- a/profile/driver_bench/rake/tasks.rake +++ b/profile/driver_bench/rake/tasks.rake @@ -2,7 +2,7 @@ task driver_bench: %i[ driver_bench:data driver_bench:run ] -SPECS_REPO_URI = 'git@github.com:mongodb/specifications.git' +SPECS_REPO_URI = 'https://github.com/mongodb/specifications' SPECS_PATH = File.expand_path('../../../specifications', __dir__) DRIVER_BENCH_DATA = File.expand_path('../../data/driver_bench', __dir__) diff --git a/spec/integration/ocsp_verifier_spec.rb b/spec/integration/ocsp_verifier_spec.rb index 7cdfaabc70..de061aa925 100644 --- a/spec/integration/ocsp_verifier_spec.rb +++ b/spec/integration/ocsp_verifier_spec.rb @@ -9,6 +9,21 @@ with_openssl_debug retry_test sleep: 5 + def self.with_ocsp_responder(port = 8100, path = '/', &setup) + around do |example| + server = WEBrick::HTTPServer.new(Port: port) + server.mount_proc path, &setup + Thread.new { server.start } + begin + example.run + ensure + server.shutdown + end + + ::Utils.wait_for_port_free(port, 5) + end + end + shared_examples 'verifies' do context 'mri' do fails_on_jruby @@ -173,21 +188,10 @@ context 'one time' do - around do |example| - server = WEBrick::HTTPServer.new(Port: 8100) - server.mount_proc '/' do |req, res| - res.status = 303 - res['locAtion'] = "http://localhost:8101#{req.path}" - res.body = "See http://localhost:8101#{req.path}" - end - Thread.new { server.start } - begin - example.run - ensure - server.shutdown - end - - ::Utils.wait_for_port_free(8100, 5) + with_ocsp_responder do |req, res| + res.status = 303 + res['locAtion'] = "http://localhost:8101#{req.path}" + res.body = "See http://localhost:8101#{req.path}" end include_context 'verifier', algorithm: algorithm @@ -248,21 +252,10 @@ port: 8101, ) - around do |example| - server = WEBrick::HTTPServer.new(Port: 8100) - server.mount_proc '/' do |req, res| - res.status = 303 - res['locAtion'] = req.path - res.body = "See #{req.path} indefinitely" - end - Thread.new { server.start } - begin - example.run - ensure - server.shutdown - end - - ::Utils.wait_for_port_free(8100, 5) + with_ocsp_responder do |req, res| + res.status = 303 + res['locAtion'] = req.path + res.body = "See #{req.path} indefinitely" end include_context 'verifier', algorithm: algorithm @@ -274,85 +267,23 @@ include_context 'verifier', algorithm: 'rsa' - context '40x / 50x' do - around do |example| - server = WEBrick::HTTPServer.new(Port: 8100) - server.mount_proc '/' do |req, res| + [400, 404, 500, 503].each do |code| + context "code #{code}" do + with_ocsp_responder do |req, res| res.status = code res.body = "HTTP #{code}" end - Thread.new { server.start } - begin - example.run - ensure - server.shutdown - end - - ::Utils.wait_for_port_free(8100, 5) - end - - [400, 404, 500, 503].each do |_code| - context "code #{_code}" do - let(:code) { _code } - include_examples 'does not verify' - end - end - end - - context '204' do - around do |example| - server = WEBrick::HTTPServer.new(Port: 8100) - server.mount_proc '/' do |req, res| - res.status = 204 - end - Thread.new { server.start } - begin - example.run - ensure - server.shutdown - end - ::Utils.wait_for_port_free(8100, 5) - end - - context "code 204" do - let(:code) { 204 } include_examples 'does not verify' end end - end - - context 'responder URI has no path' do - require_external_connectivity - - # https://github.com/jruby/jruby-openssl/issues/210 - fails_on_jruby - include_context 'basic verifier' - - # The fake certificates all have paths in them for use with the ocsp mock. - # Use real certificates retrieved from Atlas for this test as they don't - # have a path in the OCSP URI (which the test also asserts). - # Note that these certificates expire in 3 months and need to be replaced - # with a more permanent solution. - # Use the spec/support/certificates/retrieve-atlas-cert script to retrieve - # current certificates from Atlas. - let(:cert_path) { File.join(File.dirname(__FILE__), '../support/certificates/atlas-ocsp.crt') } - let(:ca_cert_path) { File.join(File.dirname(__FILE__), '../support/certificates/atlas-ocsp-ca.crt') } - let(:cert_store) do - OpenSSL::X509::Store.new.tap do |store| - store.set_default_paths + context 'code 204' do + with_ocsp_responder do |req, res| + res.status = 204 end - end - - before do - verifier.ocsp_uris.length.should > 0 - URI.parse(verifier.ocsp_uris.first).path.should == '' - end - it 'verifies' do - # TODO This test will fail if the certificate expires - expect(verifier.verify).to be(true), "If atlas-ocsp certificates have expired, run spec/support/certificates/retrieve-atlas-cert to get a new ones" + include_examples 'does not verify' end end end diff --git a/spec/integration/reconnect_spec.rb b/spec/integration/reconnect_spec.rb index f478e233dd..6d210251da 100644 --- a/spec/integration/reconnect_spec.rb +++ b/spec/integration/reconnect_spec.rb @@ -111,6 +111,10 @@ # thread.kill should've similarly failed, but it doesn't. fails_on_jruby + # odd failures related to async on ruby <= 3.1, I suspect something + # with how fibers worked in those versions. + minimum_mri_version '3.2.0' + it 'recreates SRV monitor' do wait_for_discovery @@ -151,6 +155,10 @@ # NotImplementedError: recvmsg_nonblock is not implemented fails_on_jruby + # odd failures related to async on ruby <= 3.1, I suspect something + # with how fibers worked in those versions. + minimum_mri_version '3.2.0' + let(:uri) do "mongodb+srv://test-fake.test.build.10gen.cc/" end @@ -181,8 +189,6 @@ end around do |example| - require 'support/dns' - rules = [ ['_mongodb._tcp.test-fake.test.build.10gen.cc', :srv, [0, 0, 2799, 'localhost.test.build.10gen.cc'], diff --git a/spec/integration/srv_monitoring_spec.rb b/spec/integration/srv_monitoring_spec.rb index 6d7da1f730..8c3d1560a1 100644 --- a/spec/integration/srv_monitoring_spec.rb +++ b/spec/integration/srv_monitoring_spec.rb @@ -76,9 +76,8 @@ # NotImplementedError: recvmsg_nonblock is not implemented fails_on_jruby - before(:all) do - require 'support/dns' - end + # mock dns implementation doesn't play nice with 2.7, etc. + minimum_mri_version '3.0.0' around do |example| # Speed up the tests by listening on the fake ports we are using. diff --git a/spec/integration/srv_spec.rb b/spec/integration/srv_spec.rb index da3d529339..594ff9e69b 100644 --- a/spec/integration/srv_spec.rb +++ b/spec/integration/srv_spec.rb @@ -12,10 +12,6 @@ # NotImplementedError: recvmsg_nonblock is not implemented fails_on_jruby - before(:all) do - require 'support/dns' - end - let(:uri) do "mongodb+srv://test-fake.test.build.10gen.cc/?tls=#{SpecConfig.instance.ssl?}&tlsInsecure=true" end diff --git a/spec/shared b/spec/shared index cee4bc0264..1017c94e4b 160000 --- a/spec/shared +++ b/spec/shared @@ -1 +1 @@ -Subproject commit cee4bc02649a573c8256b0505c1d23f503ac2609 +Subproject commit 1017c94e4b0962d3b68eced52566e700ae4e70b4 diff --git a/spec/support/common_shortcuts.rb b/spec/support/common_shortcuts.rb index 32d386b36a..7a4fe09e17 100644 --- a/spec/support/common_shortcuts.rb +++ b/spec/support/common_shortcuts.rb @@ -337,51 +337,33 @@ def stop_monitoring(*clients) [:tcp, "0.0.0.0", 5300], ] - def mock_dns(config) - semaphore = Mongo::Semaphore.new - - thread = Thread.new do - RubyDNS::run_server(DNS_INTERFACES) do - config.each do |(query, type, *answers)| - - resource_cls = Resolv::DNS::Resource::IN.const_get(type.to_s.upcase) - resources = answers.map do |answer| - resource_cls.new(*answer) - end - match(query, resource_cls) do |req| - req.add(resources) - end + # Starts the DNS server and returns it; should be run from within an + # Async block. Prefer #mock_dns instead, which does the setup for you. + def start_dns_server(config) + RubyDNS::run_server(DNS_INTERFACES) do + config.each do |(query, type, *answers)| + resource_cls = Resolv::DNS::Resource::IN.const_get(type.to_s.upcase) + resources = answers.map do |answer| + resource_cls.new(*answer) end - semaphore.signal + match(query, resource_cls) do |req| + req.add(resources) + end end end + end - semaphore.wait + # Starts and runs a DNS server, then yields to the attached block. + def mock_dns(config) + # only require rubydns when we need it; it's MRI-only. + require 'rubydns' - begin + Async do |task| + server = start_dns_server(config) yield ensure - 10.times do - if $last_async_task - break - end - sleep 0.5 - end - - # Hack to stop the server - https://github.com/socketry/rubydns/issues/75 - if $last_async_task.nil? - STDERR.puts "No async task - server never started?" - else - begin - $last_async_task.stop - rescue NoMethodError => e - STDERR.puts "Error stopping async task: #{e}" - end - end - - thread.kill - thread.join + server.stop end end diff --git a/spec/support/constraints.rb b/spec/support/constraints.rb index 6d92409937..8c7f3f940d 100644 --- a/spec/support/constraints.rb +++ b/spec/support/constraints.rb @@ -17,6 +17,16 @@ def require_local_tls end end + def minimum_mri_version(version) + require_mri + + before(:all) do + if RUBY_VERSION < version + skip "Ruby #{version} or greater is required" + end + end + end + def forbid_x509_auth before(:all) do skip 'X.509 auth not allowed' if SpecConfig.instance.x509_auth? diff --git a/spec/support/dns.rb b/spec/support/dns.rb deleted file mode 100644 index d868f7bc3b..0000000000 --- a/spec/support/dns.rb +++ /dev/null @@ -1,16 +0,0 @@ -# frozen_string_literal: true -# rubocop:todo all - -require 'rubydns' - -# Hack to stop the server - https://github.com/socketry/rubydns/issues/75 -module Async - class Task - alias :run_without_record :run - def run(*args) - run_without_record.tap do - $last_async_task = self - end - end - end -end