From 13e69ff9d540926d5400b7cd4e7a8703cef0b934 Mon Sep 17 00:00:00 2001 From: Durran Jordan Date: Mon, 23 May 2022 14:47:23 +0200 Subject: [PATCH 1/2] fix(NODE-4254): allow csfle to be dynamically required --- src/encrypter.ts | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/encrypter.ts b/src/encrypter.ts index a94153a93f..de654ef126 100644 --- a/src/encrypter.ts +++ b/src/encrypter.ts @@ -124,9 +124,15 @@ export class Encrypter { static checkForMongoCrypt(): void { let mongodbClientEncryption = undefined; + // Ensure you always wrap an optional require in the try block NODE-3199 try { - // Ensure you always wrap an optional require in the try block NODE-3199 - mongodbClientEncryption = require('mongodb-client-encryption'); + // Note (NODE-4254): This is to get around the circular dependency between + // mongodb-client-encryption and the driver in the test scenarios. + if (process.env.MONGODB_CLIENT_ENCRYPTION_OVERRIDE) { + mongodbClientEncryption = require(process.env.MONGODB_CLIENT_ENCRYPTION_OVERRIDE); + } else { + mongodbClientEncryption = require('mongodb-client-encryption'); + } } catch (err) { throw new MongoMissingDependencyError( 'Auto-encryption requested, but the module is not installed. ' + From b1db121f9ffd104d20ba57183af71b81dfaf636f Mon Sep 17 00:00:00 2001 From: Durran Jordan Date: Mon, 23 May 2022 17:12:45 +0200 Subject: [PATCH 2/2] test(NODE-4254): run against replica set --- .evergreen/config.yml | 2 +- .evergreen/generate_evergreen_tasks.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.evergreen/config.yml b/.evergreen/config.yml index bbf80529f9..1d7e654edc 100644 --- a/.evergreen/config.yml +++ b/.evergreen/config.yml @@ -1630,7 +1630,7 @@ tasks: - func: bootstrap mongo-orchestration vars: VERSION: latest - TOPOLOGY: server + TOPOLOGY: replica_set - func: bootstrap kms servers - func: run custom csfle tests - name: test-latest-server-noauth diff --git a/.evergreen/generate_evergreen_tasks.js b/.evergreen/generate_evergreen_tasks.js index 6d6a5e8daa..d7e4543fbf 100644 --- a/.evergreen/generate_evergreen_tasks.js +++ b/.evergreen/generate_evergreen_tasks.js @@ -512,7 +512,7 @@ oneOffFuncAsTasks.push({ func: 'bootstrap mongo-orchestration', vars: { VERSION: 'latest', - TOPOLOGY: 'server' + TOPOLOGY: 'replica_set' } }, { func: 'bootstrap kms servers' },