@@ -46,7 +46,7 @@ import {
4646 WriteConcern
4747} from '../../mongodb' ;
4848import { getEncryptExtraOptions , getEnvironmentalOptions } from '../../tools/utils' ;
49- import type { TestConfiguration } from '../runner/config' ;
49+ import { AlpineTestConfiguration , type TestConfiguration } from '../runner/config' ;
5050import { EntityEventRegistry } from './entity_event_registry' ;
5151import { trace } from './runner' ;
5252import type { ClientEntity , EntityDescription , ExpectedLogMessage } from './schema' ;
@@ -200,14 +200,7 @@ export class UnifiedMongoClient extends MongoClient {
200200 topology : 'MONGODB_LOG_TOPOLOGY'
201201 } as const ;
202202
203- constructor (
204- uri : string ,
205- description : ClientEntity ,
206- config : {
207- loggingEnabled ?: boolean ;
208- setupLogging ?: ( options : Record < string , any > , id : string ) => Record < string , any > ;
209- }
210- ) {
203+ constructor ( uri : string , description : ClientEntity , config : TestConfiguration ) {
211204 const options : MongoClientOptions = {
212205 monitorCommands : true ,
213206 __skipPingOnConnect : true ,
@@ -243,20 +236,27 @@ export class UnifiedMongoClient extends MongoClient {
243236 process . env
244237 ) ;
245238
246- const extraOptions =
247- getEncryptExtraOptions ( ) . cryptSharedLibPath != null
248- ? {
249- cryptSharedLibPath : getEncryptExtraOptions ( ) . cryptSharedLibPath ,
250- ...description . autoEncryptOpts . extraOptions
251- }
252- : { } ;
239+ let extraOptions = { } ;
240+ if ( config instanceof AlpineTestConfiguration ) {
241+ extraOptions = {
242+ ...config . encryptDefaultExtraOptions ,
243+ ...description . autoEncryptOpts . extraOptions
244+ } ;
245+ } else if ( getEncryptExtraOptions ( ) . cryptSharedLibPath != null ) {
246+ extraOptions = {
247+ cryptSharedLibPath : getEncryptExtraOptions ( ) . cryptSharedLibPath ,
248+ ...description . autoEncryptOpts . extraOptions
249+ } ;
250+ }
251+
252+ const kmsProviders = mergeKMSProviders (
253+ description . autoEncryptOpts . kmsProviders ,
254+ kmsProvidersFromEnvironment
255+ ) ;
253256
254257 options . autoEncryption = {
255258 ...description . autoEncryptOpts ,
256- kmsProviders : mergeKMSProviders (
257- description . autoEncryptOpts . kmsProviders ,
258- kmsProvidersFromEnvironment
259- ) ,
259+ kmsProviders,
260260 extraOptions
261261 } ;
262262 }
0 commit comments