From ce94fbf3b4a55fea5a70c96b8adaec06f4025ac9 Mon Sep 17 00:00:00 2001 From: Pavel Safronov Date: Mon, 16 Nov 2026 07:50:48 -0800 Subject: [PATCH 1/5] test(NODE-7697): run integration tests against disaggregated storage - Support the unified test format `dsc` runOnRequirement (schema 1.30, specs PR #2004). - Add a DSCFilter so mocha tests can declare `requires: { dsc: 'enabled' | 'disabled' }`. - Skip replSetStepDown-based tests on DSC (no electable secondary). - Sync spec tests from specs PR #2004. - Add the `ubuntu2404-test-dsc` Evergreen variant using the DET disagg scripts. TEMP: checks out the DET fork branch until drivers-evergreen-tools#918 merges. --- .evergreen/config.in.yml | 69 ++++++++++++++ .evergreen/config.yml | 94 +++++++++++++++++++ .evergreen/generate_evergreen_tasks.js | 33 +++++++ .evergreen/run-tests.sh | 2 + global.d.ts | 6 ++ .../change-streams/change_stream.test.ts | 12 ++- ...onnections_survive_step_down.prose.test.ts | 3 +- test/readme.md | 20 ++++ .../rediscover-quickly-after-step-down.json | 3 +- .../rediscover-quickly-after-step-down.yml | 4 +- test/spec/transactions/unified/commit.json | 7 +- test/spec/transactions/unified/commit.yml | 5 +- .../invalid/runOnRequirement-dsc-enum.json | 15 +++ .../invalid/runOnRequirement-dsc-enum.yml | 10 ++ .../invalid/runOnRequirement-dsc-type.json | 15 +++ .../invalid/runOnRequirement-dsc-type.yml | 10 ++ test/tools/runner/filters/dsc_filter.ts | 48 ++++++++++ test/tools/runner/hooks/configuration.ts | 2 + test/tools/unified-spec-runner/schema.ts | 1 + .../unified-spec-runner/unified-utils.ts | 17 ++++ test/unit/tools/unifed-utils.test.ts | 63 ++++++++++++- 21 files changed, 428 insertions(+), 11 deletions(-) create mode 100644 test/spec/unified-test-format/invalid/runOnRequirement-dsc-enum.json create mode 100644 test/spec/unified-test-format/invalid/runOnRequirement-dsc-enum.yml create mode 100644 test/spec/unified-test-format/invalid/runOnRequirement-dsc-type.json create mode 100644 test/spec/unified-test-format/invalid/runOnRequirement-dsc-type.yml create mode 100644 test/tools/runner/filters/dsc_filter.ts diff --git a/.evergreen/config.in.yml b/.evergreen/config.in.yml index c8ddf80141e..90c2b6d60b4 100644 --- a/.evergreen/config.in.yml +++ b/.evergreen/config.in.yml @@ -120,6 +120,74 @@ functions: script: | bash ${DRIVERS_TOOLS}/.evergreen/stop-orchestration.sh + # Disaggregated storage (DSC) deployment: a three-member replica set backed by SLS, run in containers. + # See drivers-evergreen-tools/.evergreen/disagg/README.md and "Disaggregated storage (DSC)" in test/readme.md. + "start dsc": + # TODO(NODE-7697): remove this step once mongodb-labs/drivers-evergreen-tools#918 is merged and the + # drivers-evergreen-tools submodule is bumped past it. + - command: shell.exec + type: setup + params: + working_dir: src/drivers-evergreen-tools + script: | + set -o errexit + git fetch https://github.com/mdb-ad/drivers-evergreen-tools.git dsc + git checkout FETCH_HEAD + # The SLS images are in a private ECR registry that requires this role. + - command: ec2.assume_role + params: + role_arn: arn:aws:iam::664315256653:role/disagg-storage-tf-project-ro + - command: subprocess.exec + type: setup + params: + working_dir: src + binary: bash + include_expansions_in_env: [AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, AWS_SESSION_TOKEN] + args: + - ${DRIVERS_TOOLS}/.evergreen/disagg/setup.sh + # setup.sh writes MONGODB_URI for the deployment + - command: expansions.update + params: + file: src/dsc-expansion.yml + + # mongo-orchestration does not run in DSC tasks, so fetch crypt_shared (CRYPT_SHARED_LIB_PATH) directly. + "fetch dsc crypt_shared": + # Downloads of the "latest" crypt_shared require AWS credentials (DRIVERS-3628). + - <<: *assume_secrets_manager_role + - command: subprocess.exec + type: setup + params: + working_dir: src + binary: bash + include_expansions_in_env: [AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, AWS_SESSION_TOKEN] + args: + - ${DRIVERS_TOOLS}/.evergreen/disagg/download-crypt.sh + - command: expansions.update + params: + file: src/crypt-shared-expansion.yml + + # Runs in `post` for every task, so it only acts in DSC tasks (DSC=on). + "stop dsc": + - command: shell.exec + params: + working_dir: src + shell: bash + script: | + if [[ "${DSC|}" == "on" ]]; then + bash ${DRIVERS_TOOLS}/.evergreen/disagg/teardown.sh + fi + - command: s3.put + params: + aws_key: ${aws_key} + aws_secret: ${aws_secret} + local_file: src/sls-logs.txt.gz + optional: true + remote_file: mongo-node-driver/${revision}/${version_id}/${build_id}/logs/${task_id}-${execution}-sls-logs.txt.gz + bucket: mciuploads + permissions: public-read + content_type: application/x-gzip + display_name: "sls-logs.txt.gz" + "bootstrap mongohoused": - <<: *assume_secrets_manager_role - command: shell.exec @@ -1408,6 +1476,7 @@ post: - func: "reset aws instance profile" - func: "upload test results" - func: "stop mongo-orchestration" + - func: "stop dsc" - func: "upload coverage report" - func: "cleanup" diff --git a/.evergreen/config.yml b/.evergreen/config.yml index 4f8ecb096cc..86df4b5f5ab 100644 --- a/.evergreen/config.yml +++ b/.evergreen/config.yml @@ -78,6 +78,70 @@ functions: params: script: | bash ${DRIVERS_TOOLS}/.evergreen/stop-orchestration.sh + start dsc: + - command: shell.exec + type: setup + params: + working_dir: src/drivers-evergreen-tools + script: | + set -o errexit + git fetch https://github.com/mdb-ad/drivers-evergreen-tools.git dsc + git checkout FETCH_HEAD + - command: ec2.assume_role + params: + role_arn: arn:aws:iam::664315256653:role/disagg-storage-tf-project-ro + - command: subprocess.exec + type: setup + params: + working_dir: src + binary: bash + include_expansions_in_env: + - AWS_ACCESS_KEY_ID + - AWS_SECRET_ACCESS_KEY + - AWS_SESSION_TOKEN + args: + - ${DRIVERS_TOOLS}/.evergreen/disagg/setup.sh + - command: expansions.update + params: + file: src/dsc-expansion.yml + fetch dsc crypt_shared: + - command: ec2.assume_role + params: + role_arn: ${DRIVERS_SECRETS_ARN} + - command: subprocess.exec + type: setup + params: + working_dir: src + binary: bash + include_expansions_in_env: + - AWS_ACCESS_KEY_ID + - AWS_SECRET_ACCESS_KEY + - AWS_SESSION_TOKEN + args: + - ${DRIVERS_TOOLS}/.evergreen/disagg/download-crypt.sh + - command: expansions.update + params: + file: src/crypt-shared-expansion.yml + stop dsc: + - command: shell.exec + params: + working_dir: src + shell: bash + script: | + if [[ "${DSC|}" == "on" ]]; then + bash ${DRIVERS_TOOLS}/.evergreen/disagg/teardown.sh + fi + - command: s3.put + params: + aws_key: ${aws_key} + aws_secret: ${aws_secret} + local_file: src/sls-logs.txt.gz + optional: true + remote_file: mongo-node-driver/${revision}/${version_id}/${build_id}/logs/${task_id}-${execution}-sls-logs.txt.gz + bucket: mciuploads + permissions: public-read + content_type: application/x-gzip + display_name: sls-logs.txt.gz bootstrap mongohoused: - command: ec2.assume_role params: @@ -2576,6 +2640,27 @@ tasks: - name: run-lint-checks variant: lint patch_optional: true + - name: test-dsc-replica_set + tags: + - dsc + commands: + - command: expansions.update + type: setup + params: + updates: + - {key: DSC, value: 'on'} + - {key: AUTH, value: noauth} + - {key: SSL, value: nossl} + - {key: CLIENT_ENCRYPTION, value: 'true'} + - {key: TEST_CSFLE, value: 'true'} + - func: install dependencies + - func: start dsc + - func: fetch dsc crypt_shared + - func: run tests + depends_on: + - name: run-lint-checks + variant: lint + patch_optional: true - name: test-latest-server-noauth tags: - latest @@ -4139,6 +4224,7 @@ post: - func: reset aws instance profile - func: upload test results - func: stop mongo-orchestration + - func: stop dsc - func: upload coverage report - func: cleanup ignore: @@ -4744,6 +4830,14 @@ buildvariants: run_on: rhel80-large tasks: - test_atlas_task_group_search_indexes + - name: ubuntu2404-test-dsc + display_name: Disaggregated Storage (DSC) Tests + run_on: ubuntu2404-large + expansions: + NODE_LTS_VERSION: 24 + batchtime: 1440 + tasks: + - .dsc - name: resource management tests display_name: resource management tests run_on: rhel80-large diff --git a/.evergreen/generate_evergreen_tasks.js b/.evergreen/generate_evergreen_tasks.js index 1a7dce9482d..2bfe5570a7a 100644 --- a/.evergreen/generate_evergreen_tasks.js +++ b/.evergreen/generate_evergreen_tasks.js @@ -871,6 +871,39 @@ BUILD_VARIANTS.push({ tasks: ['test_atlas_task_group_search_indexes'] }); +// Disaggregated storage (DSC): the full integration suite against a three-member replica set backed by SLS. +// DSC has no auth, TLS, standalone, or sharded deployments. See "Disaggregated storage (DSC)" in test/readme.md. +SINGLETON_TASKS.push({ + name: 'test-dsc-replica_set', + tags: ['dsc'], + commands: [ + updateExpansions({ + DSC: 'on', + AUTH: 'noauth', + SSL: 'nossl', + CLIENT_ENCRYPTION: true, + TEST_CSFLE: true + }), + { func: 'install dependencies' }, + { func: 'start dsc' }, + { func: 'fetch dsc crypt_shared' }, + { func: 'run tests' } + ] +}); + +BUILD_VARIANTS.push({ + name: 'ubuntu2404-test-dsc', + display_name: 'Disaggregated Storage (DSC) Tests', + // The SLS containers need an x86_64 Linux host with Docker. + run_on: 'ubuntu2404-large', + expansions: { + NODE_LTS_VERSION: LATEST_LTS + }, + // Not yet stable: at most once a day on mainline. + batchtime: 1440, + tasks: ['.dsc'] +}); + BUILD_VARIANTS.push({ name: 'resource management tests', display_name: 'resource management tests', diff --git a/.evergreen/run-tests.sh b/.evergreen/run-tests.sh index b87e57d605f..1341724b72e 100755 --- a/.evergreen/run-tests.sh +++ b/.evergreen/run-tests.sh @@ -9,6 +9,7 @@ set -o errexit # Exit the script with error if any of the commands fail # MARCH Machine Architecture. Defaults to lowercase uname -m # SKIP_DEPS Skip installing dependencies # TEST_CSFLE Set to enforce running csfle tests +# DSC Set to "on" when MONGODB_URI is a disaggregated storage (DSC) deployment AUTH=${AUTH:-noauth} MONGODB_URI=${MONGODB_URI:-} @@ -70,4 +71,5 @@ export MONGODB_URI=${MONGODB_URI} export LOAD_BALANCER=${LOAD_BALANCER} export TEST_CSFLE=${TEST_CSFLE} export COMPRESSOR=${COMPRESSOR} +export DSC=${DSC} npm run check:integration-coverage diff --git a/global.d.ts b/global.d.ts index 968e5b03c0a..4147f45c115 100644 --- a/global.d.ts +++ b/global.d.ts @@ -24,6 +24,12 @@ declare global { libmongocrypt?: string; tls?: 'enabled' | 'disabled'; + + /** + * 'enabled' runs the test only against a disaggregated storage deployment (DSC), + * 'disabled' never runs it against one. Set by `DSC=on`; see test/readme.md. + */ + dsc?: 'enabled' | 'disabled'; }; sessions?: { diff --git a/test/integration/change-streams/change_stream.test.ts b/test/integration/change-streams/change_stream.test.ts index 0e7f144de88..25cff5d4def 100644 --- a/test/integration/change-streams/change_stream.test.ts +++ b/test/integration/change-streams/change_stream.test.ts @@ -2292,7 +2292,8 @@ describe('ChangeStream resumability', function () { context('when the error is not a server error', function () { it( 'should resume on ServerSelectionError', - { requires: { topology: ['replicaset'] } }, + // DSC test deployments have no electable secondary, so replSetStepDown fails + { requires: { topology: ['replicaset'], dsc: 'disabled' } }, async function () { changeStream = collection.watch([]); await initIteratorMode(changeStream); @@ -2621,7 +2622,8 @@ describe('ChangeStream resumability', function () { context('when the error is not a server error', function () { it( 'should resume on ServerSelectionError', - { requires: { topology: ['replicaset'] } }, + // DSC test deployments have no electable secondary, so replSetStepDown fails + { requires: { topology: ['replicaset'], dsc: 'disabled' } }, async function () { changeStream = collection.watch([]); await initIteratorMode(changeStream); @@ -2782,7 +2784,8 @@ describe('ChangeStream resumability', function () { context('when the error is not a server error', function () { it( 'should resume on ServerSelectionError', - { requires: { topology: ['replicaset'] } }, + // DSC test deployments have no electable secondary, so replSetStepDown fails + { requires: { topology: ['replicaset'], dsc: 'disabled' } }, async function () { changeStream = collection.watch([]); await initIteratorMode(changeStream); @@ -2996,7 +2999,8 @@ describe('ChangeStream resumability', function () { context('when the error is not a server error', function () { it( 'should resume on ServerSelectionError', - { requires: { topology: ['replicaset'] } }, + // DSC test deployments have no electable secondary, so replSetStepDown fails + { requires: { topology: ['replicaset'], dsc: 'disabled' } }, async function () { changeStream = collection.watch([]); diff --git a/test/integration/connections-survive-step-down/connections_survive_step_down.prose.test.ts b/test/integration/connections-survive-step-down/connections_survive_step_down.prose.test.ts index 00d5c414ad7..6f0ff996b93 100644 --- a/test/integration/connections-survive-step-down/connections_survive_step_down.prose.test.ts +++ b/test/integration/connections-survive-step-down/connections_survive_step_down.prose.test.ts @@ -43,8 +43,9 @@ describe('Connections Survive Primary Step Down - prose', function () { client.on('connectionPoolCleared', poolClearEvent => poolClearedEvents.push(poolClearEvent)); }); - context('getMore Iteration', { requires: { topology: ['replicaset'] } }, () => { + context('getMore Iteration', { requires: { topology: ['replicaset'], dsc: 'disabled' } }, () => { // This test requires a replica set. + // It uses replSetStepDown, which fails on DSC test deployments (they have no electable secondary). let cursor: FindCursor; afterEach(() => cursor.close()); diff --git a/test/readme.md b/test/readme.md index 8d1a65c5560..05d959b2ca9 100644 --- a/test/readme.md +++ b/test/readme.md @@ -46,6 +46,7 @@ about the types of tests and how to run them. - [AWS Authentication tests](#aws-authentication-tests) - [Running AWS tests](#running-aws-tests) - [Container Tests](#container-tests) + - [Disaggregated Storage (DSC)](#disaggregated-storage-dsc) - [Node-less Runtime Testing](#node-less-runtime-testing) - [Design](#design) - [Running tests in Node-less Runtime](#running-tests-in-node-less-runtime) @@ -751,6 +752,25 @@ our existing integration test suite and run Evergreen patches against a single i _Note that in cases where the tests need to run longer than one hour to ensure that tokens expire that the mocha timeout must be increased in order for the test not to timeout._ +### Disaggregated Storage (DSC) + +A disaggregated storage cluster (DSC) is a replica set whose storage is provided by a separate storage service (SLS) +instead of a local disk. The `ubuntu2404-test-dsc` variant runs the integration suite against a three-member DSC +replica set started by [`drivers-evergreen-tools/.evergreen/disagg`](https://github.com/mongodb-labs/drivers-evergreen-tools/tree/master/.evergreen/disagg) +(the `start dsc` and `stop dsc` functions in `.evergreen/config.in.yml`). The SLS images are in a private ECR registry, +so the deployment needs an x86_64 Linux host with Docker and AWS credentials for the role in that README; running it +locally is not supported. + +The server does not report whether it uses disaggregated storage, so the test environment sets `DSC=on`. Tests that +cannot pass against a DSC are skipped with: + +- the `dsc` [runOnRequirement](https://github.com/mongodb/specifications/blob/master/source/unified-test-format/unified-test-format.md#runonrequirement) + (`require`, `forbid` or `allow`) in unified spec tests +- `requires: { dsc: 'disabled' }` metadata in other tests (or `'enabled'` for tests that only run against a DSC) + +For example, DSC test deployments have no electable secondary, so tests that step down the primary with +`replSetStepDown` are skipped. + ### Node-less Runtime Testing We are starting to remove explicit Node requirements, and are making it possible for users to provide us with the required functionality. diff --git a/test/spec/server-discovery-and-monitoring/unified/rediscover-quickly-after-step-down.json b/test/spec/server-discovery-and-monitoring/unified/rediscover-quickly-after-step-down.json index 3147a07a1e6..8420e2fc6c4 100644 --- a/test/spec/server-discovery-and-monitoring/unified/rediscover-quickly-after-step-down.json +++ b/test/spec/server-discovery-and-monitoring/unified/rediscover-quickly-after-step-down.json @@ -1,10 +1,11 @@ { "description": "rediscover-quickly-after-step-down", - "schemaVersion": "1.4", + "schemaVersion": "1.30", "runOnRequirements": [ { "minServerVersion": "4.4", "serverless": "forbid", + "dsc": "forbid", "topologies": [ "replicaset" ] diff --git a/test/spec/server-discovery-and-monitoring/unified/rediscover-quickly-after-step-down.yml b/test/spec/server-discovery-and-monitoring/unified/rediscover-quickly-after-step-down.yml index f3e7509160e..5e04b50ca0d 100644 --- a/test/spec/server-discovery-and-monitoring/unified/rediscover-quickly-after-step-down.yml +++ b/test/spec/server-discovery-and-monitoring/unified/rediscover-quickly-after-step-down.yml @@ -1,13 +1,15 @@ --- description: rediscover-quickly-after-step-down -schemaVersion: "1.4" +schemaVersion: "1.30" runOnRequirements: # 4.4 is required for streaming. # A replica set is required for replSetStepDown. + # Disaggregated storage test deployments have no electable secondary, so replSetStepDown fails. - minServerVersion: "4.4" serverless: forbid + dsc: forbid topologies: - replicaset diff --git a/test/spec/transactions/unified/commit.json b/test/spec/transactions/unified/commit.json index de3be30470c..6233af695b9 100644 --- a/test/spec/transactions/unified/commit.json +++ b/test/spec/transactions/unified/commit.json @@ -1,6 +1,6 @@ { "description": "commit", - "schemaVersion": "1.3", + "schemaVersion": "1.30", "runOnRequirements": [ { "minServerVersion": "4.0", @@ -536,6 +536,11 @@ }, { "description": "write concern error on commit", + "runOnRequirements": [ + { + "dsc": "forbid" + } + ], "operations": [ { "object": "session0", diff --git a/test/spec/transactions/unified/commit.yml b/test/spec/transactions/unified/commit.yml index e0f12fdb09b..e233fe0c7fc 100644 --- a/test/spec/transactions/unified/commit.yml +++ b/test/spec/transactions/unified/commit.yml @@ -1,6 +1,6 @@ description: commit -schemaVersion: '1.3' +schemaVersion: '1.30' runOnRequirements: - @@ -313,6 +313,9 @@ tests: - { _id: 1 } - description: 'write concern error on commit' + # Disaggregated storage deployments accept the unsatisfiable w: 10 without returning a writeConcernError. (SERVER-120912) + runOnRequirements: + - dsc: forbid operations: - object: *session0 diff --git a/test/spec/unified-test-format/invalid/runOnRequirement-dsc-enum.json b/test/spec/unified-test-format/invalid/runOnRequirement-dsc-enum.json new file mode 100644 index 00000000000..7292da33ad4 --- /dev/null +++ b/test/spec/unified-test-format/invalid/runOnRequirement-dsc-enum.json @@ -0,0 +1,15 @@ +{ + "description": "runOnRequirement-dsc-enum", + "schemaVersion": "1.30", + "runOnRequirements": [ + { + "dsc": "foo" + } + ], + "tests": [ + { + "description": "foo", + "operations": [] + } + ] +} diff --git a/test/spec/unified-test-format/invalid/runOnRequirement-dsc-enum.yml b/test/spec/unified-test-format/invalid/runOnRequirement-dsc-enum.yml new file mode 100644 index 00000000000..bdb96bf5307 --- /dev/null +++ b/test/spec/unified-test-format/invalid/runOnRequirement-dsc-enum.yml @@ -0,0 +1,10 @@ +description: "runOnRequirement-dsc-enum" + +schemaVersion: "1.30" + +runOnRequirements: + - dsc: "foo" + +tests: + - description: "foo" + operations: [] diff --git a/test/spec/unified-test-format/invalid/runOnRequirement-dsc-type.json b/test/spec/unified-test-format/invalid/runOnRequirement-dsc-type.json new file mode 100644 index 00000000000..05071f31ff8 --- /dev/null +++ b/test/spec/unified-test-format/invalid/runOnRequirement-dsc-type.json @@ -0,0 +1,15 @@ +{ + "description": "runOnRequirement-dsc-type", + "schemaVersion": "1.30", + "runOnRequirements": [ + { + "dsc": 1234 + } + ], + "tests": [ + { + "description": "foo", + "operations": [] + } + ] +} diff --git a/test/spec/unified-test-format/invalid/runOnRequirement-dsc-type.yml b/test/spec/unified-test-format/invalid/runOnRequirement-dsc-type.yml new file mode 100644 index 00000000000..08b0d549a2a --- /dev/null +++ b/test/spec/unified-test-format/invalid/runOnRequirement-dsc-type.yml @@ -0,0 +1,10 @@ +description: "runOnRequirement-dsc-type" + +schemaVersion: "1.30" + +runOnRequirements: + - dsc: 1234 + +tests: + - description: "foo" + operations: [] diff --git a/test/tools/runner/filters/dsc_filter.ts b/test/tools/runner/filters/dsc_filter.ts new file mode 100644 index 00000000000..748b9c0cc13 --- /dev/null +++ b/test/tools/runner/filters/dsc_filter.ts @@ -0,0 +1,48 @@ +import * as process from 'process'; + +import { type MongoClient } from '../../../mongodb'; +import { Filter } from './filter'; + +/** + * Whether the test deployment uses disaggregated storage (DSC). + * + * This cannot be detected from the server, so the test environment sets `DSC=on`. + * See "Disaggregated storage (DSC)" in test/readme.md. + */ +export function isDSC(): boolean { + return process.env.DSC === 'on'; +} + +/** + * Filter for tests that only run, or never run, against a disaggregated storage deployment (DSC) + * + * @example + * ```js + * metadata: { + * requires: { + * dsc: 'enabled' | 'disabled' + * } + * } + * ``` + */ +export class DSCFilter extends Filter { + dsc: 'enabled' | 'disabled'; + constructor() { + super(); + this.dsc = isDSC() ? 'enabled' : 'disabled'; + } + + override async initializeFilter( + _client: MongoClient, + context: Record + ): Promise { + context.dsc = this.dsc; + } + + filter(test: { metadata?: MongoDBMetadataUI }) { + const dsc = test.metadata?.requires?.dsc; + if (!dsc) return true; + + return dsc === this.dsc; + } +} diff --git a/test/tools/runner/hooks/configuration.ts b/test/tools/runner/hooks/configuration.ts index db6a50344b2..d5f54149c53 100644 --- a/test/tools/runner/hooks/configuration.ts +++ b/test/tools/runner/hooks/configuration.ts @@ -24,6 +24,7 @@ import { flakyTests } from '../flaky'; import { CryptSharedFilter } from '../filters/crypt_shared_filter'; import { LibmongocryptVersionFilter } from '../filters/libmongocrypt_version_filter'; import { TLSFilter } from '../filters/tls_filter'; +import { DSCFilter } from '../filters/dsc_filter'; // Default our tests to have auth enabled // A better solution will be tackled in NODE-3714 @@ -58,6 +59,7 @@ async function initializeFilters(client): Promise> { new AuthFilter(), new ClientSideEncryptionFilter(), new CryptSharedFilter(), + new DSCFilter(), new GenericPredicateFilter(), new IDMSMockServerFilter(), new LibmongocryptVersionFilter(), diff --git a/test/tools/unified-spec-runner/schema.ts b/test/tools/unified-spec-runner/schema.ts index 0f7e048b17b..147e5811849 100644 --- a/test/tools/unified-spec-runner/schema.ts +++ b/test/tools/unified-spec-runner/schema.ts @@ -118,6 +118,7 @@ export interface RunOnRequirement { | { minLibmongocryptVersion?: string; }; + dsc?: 'require' | 'forbid' | 'allow'; } export type ObservableCommandEventId = | 'commandStartedEvent' diff --git a/test/tools/unified-spec-runner/unified-utils.ts b/test/tools/unified-spec-runner/unified-utils.ts index 1d4973734ac..396d9de6997 100644 --- a/test/tools/unified-spec-runner/unified-utils.ts +++ b/test/tools/unified-spec-runner/unified-utils.ts @@ -15,6 +15,7 @@ import { type MongoClient, ReturnDocument } from '../../mongodb'; +import { isDSC } from '../runner/filters/dsc_filter'; import type { CmapEvent, CommandEvent, EntitiesMap, SdamEvent } from './entities'; import { matchesEvents } from './match'; import { MalformedOperationError } from './operations'; @@ -146,6 +147,22 @@ export async function topologySatisfies( } } + if (r.dsc != null && r.dsc !== 'allow') { + if (r.dsc === 'require') { + ok &&= isDSC(); + if (!ok && skipReason == null) { + skipReason = `requires disaggregated storage (DSC) but DSC is not set for this environment`; + } + } else if (r.dsc === 'forbid') { + ok &&= !isDSC(); + if (!ok && skipReason == null) { + skipReason = `forbids disaggregated storage (DSC) but DSC is set for this environment`; + } + } else { + throw new AssertionError(`Unexpected value for dsc: ${r.dsc}`); + } + } + if (!ok && skipReason != null) { if (ctx.currentTest) { // called from beforeEach hook diff --git a/test/unit/tools/unifed-utils.test.ts b/test/unit/tools/unifed-utils.test.ts index 9745f1c5707..4cb794bbbcc 100644 --- a/test/unit/tools/unifed-utils.test.ts +++ b/test/unit/tools/unifed-utils.test.ts @@ -1,6 +1,11 @@ -import { expect } from 'chai'; +import { AssertionError, expect } from 'chai'; +import * as process from 'process'; -import { mergeKMSProviders } from '../../tools/unified-spec-runner/unified-utils'; +import { type RunOnRequirement } from '../../tools/unified-spec-runner/schema'; +import { + mergeKMSProviders, + topologySatisfies +} from '../../tools/unified-spec-runner/unified-utils'; describe('parseOptions', function () { context('aws providers', function () { @@ -338,3 +343,57 @@ describe('parseOptions', function () { }); }); }); + +describe('topologySatisfies', function () { + context('dsc runOnRequirement', function () { + let originalDSC: string | undefined; + let ctx: { configuration: Record; currentTest: { skipReason?: string } }; + + beforeEach(function () { + originalDSC = process.env.DSC; + ctx = { configuration: {}, currentTest: {} }; + }); + + afterEach(function () { + if (originalDSC == null) delete process.env.DSC; + else process.env.DSC = originalDSC; + }); + + // The requirement only has `dsc`, so topologySatisfies never needs the server (utilClient). + const satisfies = (dsc: RunOnRequirement['dsc']) => + topologySatisfies(ctx as any, { dsc }, undefined as any); + + for (const [env, isDSC] of [ + ['on', true], + [undefined, false], + ['off', false] + ] as const) { + context(`when DSC=${env}`, function () { + beforeEach(function () { + if (env == null) delete process.env.DSC; + else process.env.DSC = env; + }); + + it(`${isDSC ? 'satisfies' : 'does not satisfy'} 'require'`, async function () { + expect(await satisfies('require')).to.equal(isDSC); + if (!isDSC) expect(ctx.currentTest.skipReason).to.match(/requires disaggregated storage/); + }); + + it(`${isDSC ? 'does not satisfy' : 'satisfies'} 'forbid'`, async function () { + expect(await satisfies('forbid')).to.equal(!isDSC); + if (isDSC) expect(ctx.currentTest.skipReason).to.match(/forbids disaggregated storage/); + }); + + it(`satisfies 'allow'`, async function () { + expect(await satisfies('allow')).to.be.true; + }); + }); + } + + it('throws on an unexpected value', async function () { + const error = await satisfies('sometimes' as any).catch(error => error); + expect(error).to.be.instanceOf(AssertionError); + expect(error.message).to.match(/Unexpected value for dsc: sometimes/); + }); + }); +}); From ad01e0a88b57ee390b43084746a6065c4d48f21b Mon Sep 17 00:00:00 2001 From: Pavel Safronov Date: Mon, 16 Nov 2026 09:08:01 -0800 Subject: [PATCH 2/5] update todo comment --- .evergreen/config.in.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.evergreen/config.in.yml b/.evergreen/config.in.yml index 90c2b6d60b4..e9ee5b0ac5a 100644 --- a/.evergreen/config.in.yml +++ b/.evergreen/config.in.yml @@ -123,7 +123,7 @@ functions: # Disaggregated storage (DSC) deployment: a three-member replica set backed by SLS, run in containers. # See drivers-evergreen-tools/.evergreen/disagg/README.md and "Disaggregated storage (DSC)" in test/readme.md. "start dsc": - # TODO(NODE-7697): remove this step once mongodb-labs/drivers-evergreen-tools#918 is merged and the + # TODO: remove this step once mongodb-labs/drivers-evergreen-tools#918 (DRIVERS-3190) is merged and the # drivers-evergreen-tools submodule is bumped past it. - command: shell.exec type: setup From 500342780330e13b3832bf0819fa6c50e06eb540 Mon Sep 17 00:00:00 2001 From: Pavel Safronov Date: Mon, 16 Nov 2026 13:04:19 -0800 Subject: [PATCH 3/5] test(NODE-7697): pin the DSC SLS image and move SLS logs out of the coverage prefix - Pin DSC_SLS_TAG to the tag the C driver uses. Unpinned, setup.sh picks the newest SLS image, and recent images never start (cell init job StartLog "store_id mismatch"). - Upload sls-logs.txt.gz under mongo-node-driver/dsc-logs/: "download and merge coverage" treats everything under ${revision}/${version_id}/ as a coverage report. --- .evergreen/config.in.yml | 6 ++++-- .evergreen/config.yml | 4 +++- .evergreen/generate_evergreen_tasks.js | 3 +++ test/readme.md | 4 +++- 4 files changed, 13 insertions(+), 4 deletions(-) diff --git a/.evergreen/config.in.yml b/.evergreen/config.in.yml index e9ee5b0ac5a..a187e142d42 100644 --- a/.evergreen/config.in.yml +++ b/.evergreen/config.in.yml @@ -142,7 +142,7 @@ functions: params: working_dir: src binary: bash - include_expansions_in_env: [AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, AWS_SESSION_TOKEN] + include_expansions_in_env: [AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, AWS_SESSION_TOKEN, DSC_SLS_TAG] args: - ${DRIVERS_TOOLS}/.evergreen/disagg/setup.sh # setup.sh writes MONGODB_URI for the deployment @@ -182,7 +182,9 @@ functions: aws_secret: ${aws_secret} local_file: src/sls-logs.txt.gz optional: true - remote_file: mongo-node-driver/${revision}/${version_id}/${build_id}/logs/${task_id}-${execution}-sls-logs.txt.gz + # Not under mongo-node-driver/${revision}/${version_id}/: "download and merge coverage" downloads + # everything under that prefix and treats every file as a coverage report. + remote_file: mongo-node-driver/dsc-logs/${version_id}/${task_id}-${execution}-sls-logs.txt.gz bucket: mciuploads permissions: public-read content_type: application/x-gzip diff --git a/.evergreen/config.yml b/.evergreen/config.yml index 86df4b5f5ab..984b421079a 100644 --- a/.evergreen/config.yml +++ b/.evergreen/config.yml @@ -99,6 +99,7 @@ functions: - AWS_ACCESS_KEY_ID - AWS_SECRET_ACCESS_KEY - AWS_SESSION_TOKEN + - DSC_SLS_TAG args: - ${DRIVERS_TOOLS}/.evergreen/disagg/setup.sh - command: expansions.update @@ -137,7 +138,7 @@ functions: aws_secret: ${aws_secret} local_file: src/sls-logs.txt.gz optional: true - remote_file: mongo-node-driver/${revision}/${version_id}/${build_id}/logs/${task_id}-${execution}-sls-logs.txt.gz + remote_file: mongo-node-driver/dsc-logs/${version_id}/${task_id}-${execution}-sls-logs.txt.gz bucket: mciuploads permissions: public-read content_type: application/x-gzip @@ -2649,6 +2650,7 @@ tasks: params: updates: - {key: DSC, value: 'on'} + - {key: DSC_SLS_TAG, value: linux-x86-64-f987ae59a6f61e0b4e3edc73663992e15c4e9261} - {key: AUTH, value: noauth} - {key: SSL, value: nossl} - {key: CLIENT_ENCRYPTION, value: 'true'} diff --git a/.evergreen/generate_evergreen_tasks.js b/.evergreen/generate_evergreen_tasks.js index 2bfe5570a7a..2248ad4a7f8 100644 --- a/.evergreen/generate_evergreen_tasks.js +++ b/.evergreen/generate_evergreen_tasks.js @@ -879,6 +879,9 @@ SINGLETON_TASKS.push({ commands: [ updateExpansions({ DSC: 'on', + // Without a pinned tag, setup.sh picks the newest SLS image, and recent images fail to start + // (StartLog "store_id mismatch"). Same tag as the C driver's DSC tasks (mongo-c-driver#2552). + DSC_SLS_TAG: 'linux-x86-64-f987ae59a6f61e0b4e3edc73663992e15c4e9261', AUTH: 'noauth', SSL: 'nossl', CLIENT_ENCRYPTION: true, diff --git a/test/readme.md b/test/readme.md index 05d959b2ca9..2fa7512e7e7 100644 --- a/test/readme.md +++ b/test/readme.md @@ -759,7 +759,9 @@ instead of a local disk. The `ubuntu2404-test-dsc` variant runs the integration replica set started by [`drivers-evergreen-tools/.evergreen/disagg`](https://github.com/mongodb-labs/drivers-evergreen-tools/tree/master/.evergreen/disagg) (the `start dsc` and `stop dsc` functions in `.evergreen/config.in.yml`). The SLS images are in a private ECR registry, so the deployment needs an x86_64 Linux host with Docker and AWS credentials for the role in that README; running it -locally is not supported. +locally is not supported. The SLS image is pinned with `DSC_SLS_TAG` in `.evergreen/generate_evergreen_tasks.js`, +because the newest images do not always start; to try a different image, change that tag. The SLS container logs are +attached to each task as `sls-logs.txt.gz`. The server does not report whether it uses disaggregated storage, so the test environment sets `DSC=on`. Tests that cannot pass against a DSC are skipped with: From 30ed32328416321aafdd45d062d82f7ef9013616 Mon Sep 17 00:00:00 2001 From: Pavel Safronov Date: Mon, 16 Nov 2026 13:22:48 -0800 Subject: [PATCH 4/5] lint --- .evergreen/config.in.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.evergreen/config.in.yml b/.evergreen/config.in.yml index a187e142d42..4beac2b7d15 100644 --- a/.evergreen/config.in.yml +++ b/.evergreen/config.in.yml @@ -142,7 +142,8 @@ functions: params: working_dir: src binary: bash - include_expansions_in_env: [AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, AWS_SESSION_TOKEN, DSC_SLS_TAG] + include_expansions_in_env: + [AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, AWS_SESSION_TOKEN, DSC_SLS_TAG] args: - ${DRIVERS_TOOLS}/.evergreen/disagg/setup.sh # setup.sh writes MONGODB_URI for the deployment From f2fad926ffd5a9f32ed57dca07d3417e53f4504f Mon Sep 17 00:00:00 2001 From: Pavel Safronov Date: Tue, 17 Nov 2026 11:28:33 -0800 Subject: [PATCH 5/5] test(NODE-7697): use merged DET disagg scripts and skip DSC-incompatible tests - Bump drivers-evergreen-tools to edf26f7 (#918) and drop the temporary fork checkout. - Skip tests that need mongocryptd on PATH, a deployment on localhost:27017, or localhost hostnames, which DSC tasks do not have. - Use a reserved .invalid hostname in the ENOTFOUND test: single-label names resolve to EAI_AGAIN on Ubuntu 24.04 (systemd-resolved). --- .evergreen/config.in.yml | 10 ---------- .evergreen/config.yml | 8 -------- drivers-evergreen-tools | 2 +- test/integration/crud/misc_cursors.test.ts | 4 +++- .../dns_seedlist.test.ts | 6 +++++- test/integration/node-specific/client_close.test.ts | 13 +++++++++---- test/integration/node-specific/mongo_client.test.ts | 2 +- .../server_description.test.ts | 5 ++++- test/integration/sessions/sessions.prose.test.ts | 8 ++++++-- 9 files changed, 29 insertions(+), 29 deletions(-) diff --git a/.evergreen/config.in.yml b/.evergreen/config.in.yml index 4beac2b7d15..54cf0feaefd 100644 --- a/.evergreen/config.in.yml +++ b/.evergreen/config.in.yml @@ -123,16 +123,6 @@ functions: # Disaggregated storage (DSC) deployment: a three-member replica set backed by SLS, run in containers. # See drivers-evergreen-tools/.evergreen/disagg/README.md and "Disaggregated storage (DSC)" in test/readme.md. "start dsc": - # TODO: remove this step once mongodb-labs/drivers-evergreen-tools#918 (DRIVERS-3190) is merged and the - # drivers-evergreen-tools submodule is bumped past it. - - command: shell.exec - type: setup - params: - working_dir: src/drivers-evergreen-tools - script: | - set -o errexit - git fetch https://github.com/mdb-ad/drivers-evergreen-tools.git dsc - git checkout FETCH_HEAD # The SLS images are in a private ECR registry that requires this role. - command: ec2.assume_role params: diff --git a/.evergreen/config.yml b/.evergreen/config.yml index 984b421079a..3b38b0bdf7b 100644 --- a/.evergreen/config.yml +++ b/.evergreen/config.yml @@ -79,14 +79,6 @@ functions: script: | bash ${DRIVERS_TOOLS}/.evergreen/stop-orchestration.sh start dsc: - - command: shell.exec - type: setup - params: - working_dir: src/drivers-evergreen-tools - script: | - set -o errexit - git fetch https://github.com/mdb-ad/drivers-evergreen-tools.git dsc - git checkout FETCH_HEAD - command: ec2.assume_role params: role_arn: arn:aws:iam::664315256653:role/disagg-storage-tf-project-ro diff --git a/drivers-evergreen-tools b/drivers-evergreen-tools index 5d52ccdbb60..edf26f76d8c 160000 --- a/drivers-evergreen-tools +++ b/drivers-evergreen-tools @@ -1 +1 @@ -Subproject commit 5d52ccdbb60f6e1749a71ce787c9f8f7da861b15 +Subproject commit edf26f76d8c8ca57b9afa780d431dede75ee3aeb diff --git a/test/integration/crud/misc_cursors.test.ts b/test/integration/crud/misc_cursors.test.ts index 0fb75397749..3bcbfa4aa32 100644 --- a/test/integration/crud/misc_cursors.test.ts +++ b/test/integration/crud/misc_cursors.test.ts @@ -129,7 +129,9 @@ describe('Cursor', function () { }); it('should correctly execute cursor count with secondary readPreference', { - metadata: { requires: { topology: 'replicaset' } }, + // The lookup below only maps 127.0.0.1 to localhost; the DSC replica set members have other + // hostnames (shard1-node1-mongod), so the selected server is not found. + metadata: { requires: { topology: 'replicaset', dsc: 'disabled' } }, async test() { const bag = []; client.on('commandStarted', filterForCommands(['count'], bag)); diff --git a/test/integration/initial-dns-seedlist-discovery/dns_seedlist.test.ts b/test/integration/initial-dns-seedlist-discovery/dns_seedlist.test.ts index 7d80ee61ff8..9d8c5f4c59d 100644 --- a/test/integration/initial-dns-seedlist-discovery/dns_seedlist.test.ts +++ b/test/integration/initial-dns-seedlist-discovery/dns_seedlist.test.ts @@ -4,7 +4,11 @@ import * as sinon from 'sinon'; import { MongoClient } from '../../mongodb'; -const metadata: MongoDBMetadataUI = { requires: { topology: '!single', tls: 'disabled' } }; +// The SRV records of test1.test.build.10gen.cc point at a replica set on localhost:27017 and 27018, +// which DSC tasks do not have. +const metadata: MongoDBMetadataUI = { + requires: { topology: '!single', tls: 'disabled', dsc: 'disabled' } +}; // This serves as a placeholder for _whatever_ node.js may throw. We only rely upon `.code` class DNSTimeoutError extends Error { diff --git a/test/integration/node-specific/client_close.test.ts b/test/integration/node-specific/client_close.test.ts index b32e5b333bd..132bab91c00 100644 --- a/test/integration/node-specific/client_close.test.ts +++ b/test/integration/node-specific/client_close.test.ts @@ -574,11 +574,16 @@ describe('MongoClient.close() Integration', () => { expect(client.s.sessionPool.sessions).to.have.length.greaterThan(0); }); - it('does not execute endSessions', { requires: { tls: 'disabled' } }, async function () { - await client.close(); + // Spawns mongocryptd from PATH, and DSC tasks do not download server binaries. + it( + 'does not execute endSessions', + { requires: { tls: 'disabled', dsc: 'disabled' } }, + async function () { + await client.close(); - expect(commands).to.deep.equal([]); - }); + expect(commands).to.deep.equal([]); + } + ); }); }); }); diff --git a/test/integration/node-specific/mongo_client.test.ts b/test/integration/node-specific/mongo_client.test.ts index 3c52b450f78..9dbea3970b0 100644 --- a/test/integration/node-specific/mongo_client.test.ts +++ b/test/integration/node-specific/mongo_client.test.ts @@ -322,7 +322,7 @@ describe('class MongoClient', function () { it('throws ENOTFOUND error when connecting to non-existent host with no auth and loadBalanced=true', async function () { const configuration = this.configuration; const client = configuration.newClient( - 'mongodb://iLoveJavaScript:27017/test?loadBalanced=true', + 'mongodb://iLoveJavaScript.invalid:27017/test?loadBalanced=true', { serverSelectionTimeoutMS: 100 } ); diff --git a/test/integration/server-discovery-and-monitoring/server_description.test.ts b/test/integration/server-discovery-and-monitoring/server_description.test.ts index 0bc9112c4b0..09058db94ba 100644 --- a/test/integration/server-discovery-and-monitoring/server_description.test.ts +++ b/test/integration/server-discovery-and-monitoring/server_description.test.ts @@ -3,8 +3,11 @@ import { expect } from 'chai'; import { MongoClient } from '../../mongodb'; import { configureMongocryptdSpawnHooks } from '../../tools/utils'; +// These tests spawn mongocryptd from PATH, and DSC tasks do not download server binaries. +const mongocryptdMetadata: MongoDBMetadataUI = { requires: { mongodb: '>=4.4', dsc: 'disabled' } }; + describe('class ServerDescription', function () { - describe('when connecting to mongocryptd', { requires: { mongodb: '>=4.4' } }, function () { + describe('when connecting to mongocryptd', mongocryptdMetadata, function () { let client: MongoClient; const { port: mongocryptdTestPort } = configureMongocryptdSpawnHooks(); diff --git a/test/integration/sessions/sessions.prose.test.ts b/test/integration/sessions/sessions.prose.test.ts index ed971612afa..f2e6b908281 100644 --- a/test/integration/sessions/sessions.prose.test.ts +++ b/test/integration/sessions/sessions.prose.test.ts @@ -156,8 +156,10 @@ describe('Sessions Prose Tests', () => { it( '18. Implicit session is ignored if connection does not support sessions', { + // Spawns mongocryptd from PATH, and DSC tasks do not download server binaries. requires: { - clientSideEncryption: true + clientSideEncryption: true, + dsc: 'disabled' } }, async function () { @@ -194,8 +196,10 @@ describe('Sessions Prose Tests', () => { it( '19. Explicit session raises an error if connection does not support sessions', { + // Spawns mongocryptd from PATH, and DSC tasks do not download server binaries. requires: { - clientSideEncryption: true + clientSideEncryption: true, + dsc: 'disabled' } }, async function () {