From 286e8ef22765042f004664d4c24f8740a0be2c24 Mon Sep 17 00:00:00 2001 From: Pavel Safronov Date: Fri, 1 May 2026 10:47:39 -0700 Subject: [PATCH 01/13] test(NODE-7561): Skip QE "prefixPreview" and "suffixPreview" tests on server 9.0.0+ Co-authored-by: Copilot --- ...e_encryption.prose.27.text_queries.test.ts | 20 ++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/test/integration/client-side-encryption/client_side_encryption.prose.27.text_queries.test.ts b/test/integration/client-side-encryption/client_side_encryption.prose.27.text_queries.test.ts index 1159b3360d3..36d59ec8304 100644 --- a/test/integration/client-side-encryption/client_side_encryption.prose.27.text_queries.test.ts +++ b/test/integration/client-side-encryption/client_side_encryption.prose.27.text_queries.test.ts @@ -14,6 +14,15 @@ const metadata: MongoDBMetadataUI = { libmongocrypt: '>=1.15.1' } }; +// # Server 9.0.0-rc0 removes support for "prefixPreview" and "suffixPreview": SERVER-123416 +const metadataWithoutPreview: MongoDBMetadataUI = { + requires: { + clientSideEncryption: '>=6.4.0', + mongodb: '>=8.2.0 <9.0.0', + topology: '!single', + libmongocrypt: '>=1.15.1' + } +}; const loadFLEDataFile = async (filename: string) => EJSON.parse( @@ -36,6 +45,7 @@ describe('27. Text Explicit Encryption', function () { // Using QE CreateCollection() and Collection.Drop(), drop and create the following collections with majority write concern: // - db.prefix-suffix using the encryptedFields option set to the contents of encryptedFields-prefix-suffix.json + // Skip this step if testing server 9.0.0+. // - db.substring using the encryptedFields option set to the contents of encryptedFields-substring.json async function dropAndCreateCollection(ns: string, encryptedFields?: Document) { const { db, collection } = MongoDBCollectionNamespace.fromString(ns); @@ -208,7 +218,7 @@ describe('27. Text Explicit Encryption', function () { await Promise.allSettled([utilClient.close(), encryptedClient.close(), keyVaultClient.close()]); }); - it('Case 1: can find a document by prefix', metadata, async function () { + it('Case 1: can find a document by prefix', metadataWithoutPreview, async function () { // Use clientEncryption.encrypt() to encrypt the string "foo" with the following EncryptOpts: // class EncryptOpts { // keyId : , @@ -260,7 +270,7 @@ describe('27. Text Explicit Encryption', function () { expect(result).to.deep.equal({ _id: 0, encryptedText: 'foobarbaz' }); }); - it('Case 2: can find a document by suffix', metadata, async function () { + it('Case 2: can find a document by suffix', metadataWithoutPreview, async function () { // Use clientEncryption.encrypt() to encrypt the string "baz" with the following EncryptOpts: // class EncryptOpts { // keyId : , @@ -311,7 +321,7 @@ describe('27. Text Explicit Encryption', function () { expect(result).to.deep.equal({ _id: 0, encryptedText: 'foobarbaz' }); }); - it('Case 3: assert no document found by prefix', metadata, async function () { + it('Case 3: assert no document found by prefix', metadataWithoutPreview, async function () { // Use clientEncryption.encrypt() to encrypt the string "baz" with the following EncryptOpts: // class EncryptOpts { // keyId : , @@ -351,7 +361,7 @@ describe('27. Text Explicit Encryption', function () { expect(await encryptedClient.db('db').collection('prefix-suffix').findOne(filter)).to.be.null; }); - it('Case 4: assert no document found by suffix', metadata, async function () { + it('Case 4: assert no document found by suffix', metadataWithoutPreview, async function () { // Use clientEncryption.encrypt() to encrypt the string "foo" with the following EncryptOpts: // class EncryptOpts { // keyId : , @@ -497,7 +507,7 @@ describe('27. Text Explicit Encryption', function () { expect(result).to.be.null; }); - it('Case 7: assert contentionFactor is required', metadata, async function () { + it('Case 7: assert contentionFactor is required', metadataWithoutPreview, async function () { // Use clientEncryption.encrypt() to encrypt the string "foo" with the following EncryptOpts: // class EncryptOpts { // keyId : , From 2e65a50031d8f93a540aa53472c19cc85656c17c Mon Sep 17 00:00:00 2001 From: Pavel Safronov Date: Fri, 1 May 2026 11:10:53 -0700 Subject: [PATCH 02/13] added comments to match source --- .../client_side_encryption.prose.27.text_queries.test.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/test/integration/client-side-encryption/client_side_encryption.prose.27.text_queries.test.ts b/test/integration/client-side-encryption/client_side_encryption.prose.27.text_queries.test.ts index 36d59ec8304..df590ace814 100644 --- a/test/integration/client-side-encryption/client_side_encryption.prose.27.text_queries.test.ts +++ b/test/integration/client-side-encryption/client_side_encryption.prose.27.text_queries.test.ts @@ -219,6 +219,7 @@ describe('27. Text Explicit Encryption', function () { }); it('Case 1: can find a document by prefix', metadataWithoutPreview, async function () { + // Skip this test case if testing MongoDB server 9.0.0+. // Use clientEncryption.encrypt() to encrypt the string "foo" with the following EncryptOpts: // class EncryptOpts { // keyId : , @@ -271,6 +272,7 @@ describe('27. Text Explicit Encryption', function () { }); it('Case 2: can find a document by suffix', metadataWithoutPreview, async function () { + // Skip this test case if testing MongoDB server 9.0.0+. // Use clientEncryption.encrypt() to encrypt the string "baz" with the following EncryptOpts: // class EncryptOpts { // keyId : , @@ -322,6 +324,7 @@ describe('27. Text Explicit Encryption', function () { }); it('Case 3: assert no document found by prefix', metadataWithoutPreview, async function () { + // Skip this test case if testing MongoDB server 9.0.0+. // Use clientEncryption.encrypt() to encrypt the string "baz" with the following EncryptOpts: // class EncryptOpts { // keyId : , @@ -362,6 +365,7 @@ describe('27. Text Explicit Encryption', function () { }); it('Case 4: assert no document found by suffix', metadataWithoutPreview, async function () { + // Skip this test case if testing MongoDB server 9.0.0+. // Use clientEncryption.encrypt() to encrypt the string "foo" with the following EncryptOpts: // class EncryptOpts { // keyId : , @@ -508,6 +512,7 @@ describe('27. Text Explicit Encryption', function () { }); it('Case 7: assert contentionFactor is required', metadataWithoutPreview, async function () { + // Skip this test case if testing MongoDB server 9.0.0+. // Use clientEncryption.encrypt() to encrypt the string "foo" with the following EncryptOpts: // class EncryptOpts { // keyId : , From 5b84994ff472161947c6efd07761f685565143b2 Mon Sep 17 00:00:00 2001 From: Pavel Safronov Date: Fri, 1 May 2026 11:11:12 -0700 Subject: [PATCH 03/13] updated unified json/yml files --- .../tests/unified/QE-Text-cleanupStructuredEncryptionData.json | 1 + .../tests/unified/QE-Text-cleanupStructuredEncryptionData.yml | 1 + .../tests/unified/QE-Text-compactStructuredEncryptionData.json | 1 + .../tests/unified/QE-Text-compactStructuredEncryptionData.yml | 1 + .../tests/unified/QE-Text-prefixPreview.json | 1 + .../tests/unified/QE-Text-prefixPreview.yml | 1 + .../tests/unified/QE-Text-substringPreview.json | 2 +- .../tests/unified/QE-Text-substringPreview.yml | 2 +- .../tests/unified/QE-Text-suffixPreview.json | 1 + .../tests/unified/QE-Text-suffixPreview.yml | 1 + 10 files changed, 10 insertions(+), 2 deletions(-) diff --git a/test/spec/client-side-encryption/tests/unified/QE-Text-cleanupStructuredEncryptionData.json b/test/spec/client-side-encryption/tests/unified/QE-Text-cleanupStructuredEncryptionData.json index 24f33ab3ecb..fd74573ea26 100644 --- a/test/spec/client-side-encryption/tests/unified/QE-Text-cleanupStructuredEncryptionData.json +++ b/test/spec/client-side-encryption/tests/unified/QE-Text-cleanupStructuredEncryptionData.json @@ -4,6 +4,7 @@ "runOnRequirements": [ { "minServerVersion": "8.2.0", + "maxServerVersion": "8.99.99", "topologies": [ "replicaset", "sharded", diff --git a/test/spec/client-side-encryption/tests/unified/QE-Text-cleanupStructuredEncryptionData.yml b/test/spec/client-side-encryption/tests/unified/QE-Text-cleanupStructuredEncryptionData.yml index a326cca63db..8d8979bd234 100644 --- a/test/spec/client-side-encryption/tests/unified/QE-Text-cleanupStructuredEncryptionData.yml +++ b/test/spec/client-side-encryption/tests/unified/QE-Text-cleanupStructuredEncryptionData.yml @@ -2,6 +2,7 @@ description: QE-Text-cleanupStructuredEncryptionData schemaVersion: "1.25" runOnRequirements: - minServerVersion: "8.2.0" # Server 8.2.0 adds preview support for QE text queries. + maxServerVersion: "8.99.99" # Server 9.0.0-rc0 removes support for "prefixPreview" and "suffixPreview": SERVER-123416 topologies: ["replicaset", "sharded", "load-balanced"] # QE does not support standalone. csfle: minLibmongocryptVersion: 1.15.0 # For SPM-4158. diff --git a/test/spec/client-side-encryption/tests/unified/QE-Text-compactStructuredEncryptionData.json b/test/spec/client-side-encryption/tests/unified/QE-Text-compactStructuredEncryptionData.json index c7abfe2d4bc..a89ab96fc4c 100644 --- a/test/spec/client-side-encryption/tests/unified/QE-Text-compactStructuredEncryptionData.json +++ b/test/spec/client-side-encryption/tests/unified/QE-Text-compactStructuredEncryptionData.json @@ -4,6 +4,7 @@ "runOnRequirements": [ { "minServerVersion": "8.2.0", + "maxServerVersion": "8.99.99", "topologies": [ "replicaset", "sharded", diff --git a/test/spec/client-side-encryption/tests/unified/QE-Text-compactStructuredEncryptionData.yml b/test/spec/client-side-encryption/tests/unified/QE-Text-compactStructuredEncryptionData.yml index 994e6209eab..d608cd038f8 100644 --- a/test/spec/client-side-encryption/tests/unified/QE-Text-compactStructuredEncryptionData.yml +++ b/test/spec/client-side-encryption/tests/unified/QE-Text-compactStructuredEncryptionData.yml @@ -2,6 +2,7 @@ description: QE-Text-compactStructuredEncryptionData schemaVersion: "1.25" runOnRequirements: - minServerVersion: "8.2.0" # Server 8.2.0 adds preview support for QE text queries. + maxServerVersion: "8.99.99" # Server 9.0.0-rc0 removes support for "prefixPreview" and "suffixPreview": SERVER-123416 topologies: ["replicaset", "sharded", "load-balanced"] # QE does not support standalone. csfle: minLibmongocryptVersion: 1.15.0 # For SPM-4158. diff --git a/test/spec/client-side-encryption/tests/unified/QE-Text-prefixPreview.json b/test/spec/client-side-encryption/tests/unified/QE-Text-prefixPreview.json index 7279385743f..c193608e887 100644 --- a/test/spec/client-side-encryption/tests/unified/QE-Text-prefixPreview.json +++ b/test/spec/client-side-encryption/tests/unified/QE-Text-prefixPreview.json @@ -4,6 +4,7 @@ "runOnRequirements": [ { "minServerVersion": "8.2.0", + "maxServerVersion": "8.99.99", "topologies": [ "replicaset", "sharded", diff --git a/test/spec/client-side-encryption/tests/unified/QE-Text-prefixPreview.yml b/test/spec/client-side-encryption/tests/unified/QE-Text-prefixPreview.yml index 6f228e2d708..aca60fdabf2 100644 --- a/test/spec/client-side-encryption/tests/unified/QE-Text-prefixPreview.yml +++ b/test/spec/client-side-encryption/tests/unified/QE-Text-prefixPreview.yml @@ -2,6 +2,7 @@ description: QE-Text-prefixPreview schemaVersion: "1.25" runOnRequirements: - minServerVersion: "8.2.0" # Server 8.2.0 adds preview support for QE text queries. + maxServerVersion: "8.99.99" # Server 9.0.0-rc0 removes support for "prefixPreview" and "suffixPreview": SERVER-123416 topologies: ["replicaset", "sharded", "load-balanced"] # QE does not support standalone. csfle: minLibmongocryptVersion: 1.15.0 # For SPM-4158. diff --git a/test/spec/client-side-encryption/tests/unified/QE-Text-substringPreview.json b/test/spec/client-side-encryption/tests/unified/QE-Text-substringPreview.json index 6a8f133eac5..7787194fc65 100644 --- a/test/spec/client-side-encryption/tests/unified/QE-Text-substringPreview.json +++ b/test/spec/client-side-encryption/tests/unified/QE-Text-substringPreview.json @@ -126,7 +126,7 @@ ], "tests": [ { - "description": "Insert QE suffixPreview", + "description": "Insert QE substringPreview", "operations": [ { "name": "insertOne", diff --git a/test/spec/client-side-encryption/tests/unified/QE-Text-substringPreview.yml b/test/spec/client-side-encryption/tests/unified/QE-Text-substringPreview.yml index cee6a9f7ca4..a58a77743ee 100644 --- a/test/spec/client-side-encryption/tests/unified/QE-Text-substringPreview.yml +++ b/test/spec/client-side-encryption/tests/unified/QE-Text-substringPreview.yml @@ -74,7 +74,7 @@ initialData: ], } tests: - - description: "Insert QE suffixPreview" + - description: "Insert QE substringPreview" operations: - name: insertOne arguments: diff --git a/test/spec/client-side-encryption/tests/unified/QE-Text-suffixPreview.json b/test/spec/client-side-encryption/tests/unified/QE-Text-suffixPreview.json index deec5e63b07..2de5cde4a4b 100644 --- a/test/spec/client-side-encryption/tests/unified/QE-Text-suffixPreview.json +++ b/test/spec/client-side-encryption/tests/unified/QE-Text-suffixPreview.json @@ -4,6 +4,7 @@ "runOnRequirements": [ { "minServerVersion": "8.2.0", + "maxServerVersion": "8.99.99", "topologies": [ "replicaset", "sharded", diff --git a/test/spec/client-side-encryption/tests/unified/QE-Text-suffixPreview.yml b/test/spec/client-side-encryption/tests/unified/QE-Text-suffixPreview.yml index 9a6925a2a1c..e2ddd9f0d41 100644 --- a/test/spec/client-side-encryption/tests/unified/QE-Text-suffixPreview.yml +++ b/test/spec/client-side-encryption/tests/unified/QE-Text-suffixPreview.yml @@ -2,6 +2,7 @@ description: QE-Text-suffixPreview schemaVersion: "1.25" runOnRequirements: - minServerVersion: "8.2.0" # Server 8.2.0 adds preview support for QE text queries. + maxServerVersion: "8.99.99" # Server 9.0.0-rc0 removes support for "prefixPreview" and "suffixPreview": SERVER-123416 topologies: ["replicaset", "sharded", "load-balanced"] # QE does not support standalone. csfle: minLibmongocryptVersion: 1.15.0 # For SPM-4158. From abd126dcc130f43a11e54475e116041584a4998f Mon Sep 17 00:00:00 2001 From: Pavel Safronov Date: Fri, 1 May 2026 11:46:30 -0700 Subject: [PATCH 04/13] skip setup in some cases --- ...t_side_encryption.prose.27.text_queries.test.ts | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/test/integration/client-side-encryption/client_side_encryption.prose.27.text_queries.test.ts b/test/integration/client-side-encryption/client_side_encryption.prose.27.text_queries.test.ts index df590ace814..8b678b317a5 100644 --- a/test/integration/client-side-encryption/client_side_encryption.prose.27.text_queries.test.ts +++ b/test/integration/client-side-encryption/client_side_encryption.prose.27.text_queries.test.ts @@ -42,6 +42,8 @@ describe('27. Text Explicit Encryption', function () { beforeEach(async function () { utilClient = this.configuration.newClient(); + const isServer9OrAbove = this.configuration.version >= '9.0.0'; + const shouldRunPrefixSuffixTests = !isServer9OrAbove; // Using QE CreateCollection() and Collection.Drop(), drop and create the following collections with majority write concern: // - db.prefix-suffix using the encryptedFields option set to the contents of encryptedFields-prefix-suffix.json @@ -59,10 +61,12 @@ describe('27. Text Explicit Encryption', function () { }); } - await dropAndCreateCollection( - 'db.prefix-suffix', - await loadFLEDataFile('encryptedFields-prefix-suffix.json') - ); + if (shouldRunPrefixSuffixTests) { + await dropAndCreateCollection( + 'db.prefix-suffix', + await loadFLEDataFile('encryptedFields-prefix-suffix.json') + ); + } await dropAndCreateCollection( 'db.substring', await loadFLEDataFile('encryptedFields-substring.json') @@ -154,6 +158,7 @@ describe('27. Text Explicit Encryption', function () { } }); + if (shouldRunPrefixSuffixTests) { // Use `encryptedClient` to insert the following document into `db.prefix-suffix` with majority write concern: // { "_id": 0, "encryptedText": } await encryptedClient @@ -166,6 +171,7 @@ describe('27. Text Explicit Encryption', function () { }, { writeConcern: { w: 'majority' } } ); + } } { From 48671d09c3aec7dbf3162108f1795ddcd6d132db Mon Sep 17 00:00:00 2001 From: Pavel Safronov Date: Fri, 1 May 2026 12:11:06 -0700 Subject: [PATCH 05/13] lint --- ...e_encryption.prose.27.text_queries.test.ts | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/test/integration/client-side-encryption/client_side_encryption.prose.27.text_queries.test.ts b/test/integration/client-side-encryption/client_side_encryption.prose.27.text_queries.test.ts index 8b678b317a5..47ed4bf214f 100644 --- a/test/integration/client-side-encryption/client_side_encryption.prose.27.text_queries.test.ts +++ b/test/integration/client-side-encryption/client_side_encryption.prose.27.text_queries.test.ts @@ -159,18 +159,18 @@ describe('27. Text Explicit Encryption', function () { }); if (shouldRunPrefixSuffixTests) { - // Use `encryptedClient` to insert the following document into `db.prefix-suffix` with majority write concern: - // { "_id": 0, "encryptedText": } - await encryptedClient - .db('db') - .collection<{ _id: number; encryptedText: Binary }>('prefix-suffix') - .insertOne( - { - _id: 0, - encryptedText - }, - { writeConcern: { w: 'majority' } } - ); + // Use `encryptedClient` to insert the following document into `db.prefix-suffix` with majority write concern: + // { "_id": 0, "encryptedText": } + await encryptedClient + .db('db') + .collection<{ _id: number; encryptedText: Binary }>('prefix-suffix') + .insertOne( + { + _id: 0, + encryptedText + }, + { writeConcern: { w: 'majority' } } + ); } } From f7d4dd59e6dc08ce609a4f80b605c980fcf1048f Mon Sep 17 00:00:00 2001 From: Pavel Safronov Date: Fri, 1 May 2026 14:44:24 -0700 Subject: [PATCH 06/13] skip some tests against mdb 9 --- test/integration/change-streams/change_streams.spec.test.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/test/integration/change-streams/change_streams.spec.test.ts b/test/integration/change-streams/change_streams.spec.test.ts index 451acc7a2dc..8e8b56ef878 100644 --- a/test/integration/change-streams/change_streams.spec.test.ts +++ b/test/integration/change-streams/change_streams.spec.test.ts @@ -3,6 +3,7 @@ import * as path from 'path'; import { loadSpecTests } from '../../spec'; import { runUnifiedSuite } from '../../tools/unified-spec-runner/runner'; -describe('Change Streams Spec - Unified', function () { +// TODO: NODE-7559 - remove the mongodb version requirement once the spec tests are updated to be compatible with MongoDB 9.0 +describe('Change Streams Spec - Unified', { requires: { mongodb: '<9.0.0' } }, function () { runUnifiedSuite(loadSpecTests(path.join('change-streams', 'unified'))); }); From d6d6570ad0d8cac0f44db424dc77297fd9d19cdd Mon Sep 17 00:00:00 2001 From: Pavel Safronov Date: Fri, 1 May 2026 17:24:49 -0700 Subject: [PATCH 07/13] really skip that test --- .../integration/change-streams/change_streams.spec.test.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/test/integration/change-streams/change_streams.spec.test.ts b/test/integration/change-streams/change_streams.spec.test.ts index 8e8b56ef878..faad6eabdf2 100644 --- a/test/integration/change-streams/change_streams.spec.test.ts +++ b/test/integration/change-streams/change_streams.spec.test.ts @@ -2,8 +2,11 @@ import * as path from 'path'; import { loadSpecTests } from '../../spec'; import { runUnifiedSuite } from '../../tools/unified-spec-runner/runner'; +import { config } from 'chai'; // TODO: NODE-7559 - remove the mongodb version requirement once the spec tests are updated to be compatible with MongoDB 9.0 -describe('Change Streams Spec - Unified', { requires: { mongodb: '<9.0.0' } }, function () { - runUnifiedSuite(loadSpecTests(path.join('change-streams', 'unified'))); +describe('Change Streams Spec - Unified', function () { + it('should run, unless it should not', { requires: { mongodb: '<9.0' } }, function () { + runUnifiedSuite(loadSpecTests(path.join('change-streams', 'unified'))); + }); }); From 178b0dcebad85bba439fe081eff186db75279fca Mon Sep 17 00:00:00 2001 From: Pavel Safronov Date: Fri, 1 May 2026 18:45:43 -0700 Subject: [PATCH 08/13] lint --- test/integration/change-streams/change_streams.spec.test.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/test/integration/change-streams/change_streams.spec.test.ts b/test/integration/change-streams/change_streams.spec.test.ts index faad6eabdf2..9b08c5f2454 100644 --- a/test/integration/change-streams/change_streams.spec.test.ts +++ b/test/integration/change-streams/change_streams.spec.test.ts @@ -2,7 +2,6 @@ import * as path from 'path'; import { loadSpecTests } from '../../spec'; import { runUnifiedSuite } from '../../tools/unified-spec-runner/runner'; -import { config } from 'chai'; // TODO: NODE-7559 - remove the mongodb version requirement once the spec tests are updated to be compatible with MongoDB 9.0 describe('Change Streams Spec - Unified', function () { From 06b6ce52c65fb8eeb02a838777a0da3e68be0ab0 Mon Sep 17 00:00:00 2001 From: Pavel Safronov Date: Mon, 4 May 2026 09:51:25 -0700 Subject: [PATCH 09/13] explicitly log the mdb version comparison --- test/tools/runner/filters/mongodb_version_filter.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/test/tools/runner/filters/mongodb_version_filter.ts b/test/tools/runner/filters/mongodb_version_filter.ts index 8d1eb6307ff..e382f7ab4cd 100755 --- a/test/tools/runner/filters/mongodb_version_filter.ts +++ b/test/tools/runner/filters/mongodb_version_filter.ts @@ -34,6 +34,8 @@ export class MongoDBVersionFilter extends Filter { if (!test.metadata.requires) return true; if (!test.metadata.requires.mongodb) return true; if (typeof this.version !== 'string') throw new Error('expected version string!'); - return semver.satisfies(this.version, test.metadata.requires.mongodb); + const isVersionCompatible = semver.satisfies(this.version, test.metadata.requires.mongodb); + console.log(`Checking mongodb version requirement ${test.metadata.requires.mongodb} against version ${this.version}, result: ${isVersionCompatible}`); + return isVersionCompatible; } } From eb1a16d7f8df33d00a01532b2ec66b7b8bd5e590 Mon Sep 17 00:00:00 2001 From: Pavel Safronov Date: Mon, 4 May 2026 10:24:15 -0700 Subject: [PATCH 10/13] move the version check --- .../change-streams/change_streams.spec.test.ts | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/test/integration/change-streams/change_streams.spec.test.ts b/test/integration/change-streams/change_streams.spec.test.ts index 9b08c5f2454..25746832535 100644 --- a/test/integration/change-streams/change_streams.spec.test.ts +++ b/test/integration/change-streams/change_streams.spec.test.ts @@ -1,11 +1,16 @@ import * as path from 'path'; +import { gte } from 'semver'; import { loadSpecTests } from '../../spec'; import { runUnifiedSuite } from '../../tools/unified-spec-runner/runner'; -// TODO: NODE-7559 - remove the mongodb version requirement once the spec tests are updated to be compatible with MongoDB 9.0 +// TODO: NODE-7559 - remove once spec tests are compatible with MongoDB 9.0 describe('Change Streams Spec - Unified', function () { - it('should run, unless it should not', { requires: { mongodb: '<9.0' } }, function () { - runUnifiedSuite(loadSpecTests(path.join('change-streams', 'unified'))); - }); + runUnifiedSuite( + loadSpecTests(path.join('change-streams', 'unified')), + (_test, ctx) => + gte(ctx.version, '9.0.0') + ? 'TODO(NODE-7559): change stream spec tests not yet compatible with MongoDB >= 9.0' + : false + ); }); From 8886a4a0bfa610c0e0561efe471198427ab551ee Mon Sep 17 00:00:00 2001 From: Pavel Safronov Date: Mon, 4 May 2026 11:14:07 -0700 Subject: [PATCH 11/13] lint --- .../change-streams/change_streams.spec.test.ts | 10 ++++------ test/tools/runner/filters/mongodb_version_filter.ts | 1 - 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/test/integration/change-streams/change_streams.spec.test.ts b/test/integration/change-streams/change_streams.spec.test.ts index 25746832535..a469f418e90 100644 --- a/test/integration/change-streams/change_streams.spec.test.ts +++ b/test/integration/change-streams/change_streams.spec.test.ts @@ -6,11 +6,9 @@ import { runUnifiedSuite } from '../../tools/unified-spec-runner/runner'; // TODO: NODE-7559 - remove once spec tests are compatible with MongoDB 9.0 describe('Change Streams Spec - Unified', function () { - runUnifiedSuite( - loadSpecTests(path.join('change-streams', 'unified')), - (_test, ctx) => - gte(ctx.version, '9.0.0') - ? 'TODO(NODE-7559): change stream spec tests not yet compatible with MongoDB >= 9.0' - : false + runUnifiedSuite(loadSpecTests(path.join('change-streams', 'unified')), (_test, ctx) => + gte(ctx.version, '9.0.0') + ? 'TODO(NODE-7559): change stream spec tests not yet compatible with MongoDB >= 9.0' + : false ); }); diff --git a/test/tools/runner/filters/mongodb_version_filter.ts b/test/tools/runner/filters/mongodb_version_filter.ts index e382f7ab4cd..cf306b1e8b4 100755 --- a/test/tools/runner/filters/mongodb_version_filter.ts +++ b/test/tools/runner/filters/mongodb_version_filter.ts @@ -35,7 +35,6 @@ export class MongoDBVersionFilter extends Filter { if (!test.metadata.requires.mongodb) return true; if (typeof this.version !== 'string') throw new Error('expected version string!'); const isVersionCompatible = semver.satisfies(this.version, test.metadata.requires.mongodb); - console.log(`Checking mongodb version requirement ${test.metadata.requires.mongodb} against version ${this.version}, result: ${isVersionCompatible}`); return isVersionCompatible; } } From 574dd904f4467f5695fb56c1661be93eb6c2b036 Mon Sep 17 00:00:00 2001 From: Pavel Safronov Date: Mon, 4 May 2026 13:42:02 -0700 Subject: [PATCH 12/13] use semver to test version fit --- .../client_side_encryption.prose.27.text_queries.test.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/test/integration/client-side-encryption/client_side_encryption.prose.27.text_queries.test.ts b/test/integration/client-side-encryption/client_side_encryption.prose.27.text_queries.test.ts index 47ed4bf214f..be475509fa0 100644 --- a/test/integration/client-side-encryption/client_side_encryption.prose.27.text_queries.test.ts +++ b/test/integration/client-side-encryption/client_side_encryption.prose.27.text_queries.test.ts @@ -3,6 +3,7 @@ import { join } from 'node:path'; import { type Binary, type Document, EJSON } from 'bson'; import { expect } from 'chai'; +import * as semver from 'semver'; import { getCSFLEKMSProviders } from '../../csfle-kms-providers'; import { ClientEncryption, type MongoClient, MongoDBCollectionNamespace } from '../../mongodb'; @@ -42,8 +43,11 @@ describe('27. Text Explicit Encryption', function () { beforeEach(async function () { utilClient = this.configuration.newClient(); - const isServer9OrAbove = this.configuration.version >= '9.0.0'; + const isServer9OrAbove = semver.satisfies(this.configuration.version, '>=9.0.0'); const shouldRunPrefixSuffixTests = !isServer9OrAbove; + console.log( + `Running tests for MongoDB version ${this.configuration.version}. Prefix/suffix tests should ${shouldRunPrefixSuffixTests ? '' : 'not'} run.` + ); // Using QE CreateCollection() and Collection.Drop(), drop and create the following collections with majority write concern: // - db.prefix-suffix using the encryptedFields option set to the contents of encryptedFields-prefix-suffix.json From 72a6c9c46a654c157c2d8fc14af442d57cb47ce0 Mon Sep 17 00:00:00 2001 From: Pavel Safronov Date: Tue, 5 May 2026 10:01:25 -0700 Subject: [PATCH 13/13] pr feedback: remove unrelated changes --- .../change-streams/change_streams.spec.test.ts | 8 +------- .../client_side_encryption.prose.27.text_queries.test.ts | 3 --- test/tools/runner/filters/mongodb_version_filter.ts | 3 +-- 3 files changed, 2 insertions(+), 12 deletions(-) diff --git a/test/integration/change-streams/change_streams.spec.test.ts b/test/integration/change-streams/change_streams.spec.test.ts index a469f418e90..451acc7a2dc 100644 --- a/test/integration/change-streams/change_streams.spec.test.ts +++ b/test/integration/change-streams/change_streams.spec.test.ts @@ -1,14 +1,8 @@ import * as path from 'path'; -import { gte } from 'semver'; import { loadSpecTests } from '../../spec'; import { runUnifiedSuite } from '../../tools/unified-spec-runner/runner'; -// TODO: NODE-7559 - remove once spec tests are compatible with MongoDB 9.0 describe('Change Streams Spec - Unified', function () { - runUnifiedSuite(loadSpecTests(path.join('change-streams', 'unified')), (_test, ctx) => - gte(ctx.version, '9.0.0') - ? 'TODO(NODE-7559): change stream spec tests not yet compatible with MongoDB >= 9.0' - : false - ); + runUnifiedSuite(loadSpecTests(path.join('change-streams', 'unified'))); }); diff --git a/test/integration/client-side-encryption/client_side_encryption.prose.27.text_queries.test.ts b/test/integration/client-side-encryption/client_side_encryption.prose.27.text_queries.test.ts index be475509fa0..03a1112e17e 100644 --- a/test/integration/client-side-encryption/client_side_encryption.prose.27.text_queries.test.ts +++ b/test/integration/client-side-encryption/client_side_encryption.prose.27.text_queries.test.ts @@ -45,9 +45,6 @@ describe('27. Text Explicit Encryption', function () { utilClient = this.configuration.newClient(); const isServer9OrAbove = semver.satisfies(this.configuration.version, '>=9.0.0'); const shouldRunPrefixSuffixTests = !isServer9OrAbove; - console.log( - `Running tests for MongoDB version ${this.configuration.version}. Prefix/suffix tests should ${shouldRunPrefixSuffixTests ? '' : 'not'} run.` - ); // Using QE CreateCollection() and Collection.Drop(), drop and create the following collections with majority write concern: // - db.prefix-suffix using the encryptedFields option set to the contents of encryptedFields-prefix-suffix.json diff --git a/test/tools/runner/filters/mongodb_version_filter.ts b/test/tools/runner/filters/mongodb_version_filter.ts index cf306b1e8b4..8d1eb6307ff 100755 --- a/test/tools/runner/filters/mongodb_version_filter.ts +++ b/test/tools/runner/filters/mongodb_version_filter.ts @@ -34,7 +34,6 @@ export class MongoDBVersionFilter extends Filter { if (!test.metadata.requires) return true; if (!test.metadata.requires.mongodb) return true; if (typeof this.version !== 'string') throw new Error('expected version string!'); - const isVersionCompatible = semver.satisfies(this.version, test.metadata.requires.mongodb); - return isVersionCompatible; + return semver.satisfies(this.version, test.metadata.requires.mongodb); } }