@@ -65,7 +65,9 @@ function convertToConnStringMap(obj: Record<string, any>) {
65
65
return result . join ( ',' ) ;
66
66
}
67
67
68
- function getCompressor ( compressor : string ) : CompressorName {
68
+ function getCompressor ( compressor : string | undefined ) : CompressorName {
69
+ if ( ! compressor ) return null ;
70
+
69
71
switch ( compressor ) {
70
72
case 'zstd' :
71
73
return 'zstd' ;
@@ -74,7 +76,7 @@ function getCompressor(compressor: string): CompressorName {
74
76
case 'snappy' :
75
77
return 'snappy' ;
76
78
default :
77
- return 'none' ;
79
+ throw new Error ( 'unsupported test runner compressor, would default to no compression' ) ;
78
80
}
79
81
}
80
82
@@ -137,11 +139,11 @@ export class TestConfiguration {
137
139
replicaSet : url . searchParams . get ( 'replicaSet' ) ,
138
140
proxyURIParams : url . searchParams . get ( 'proxyHost' )
139
141
? {
140
- proxyHost : url . searchParams . get ( 'proxyHost' ) ,
141
- proxyPort : Number ( url . searchParams . get ( 'proxyPort' ) ) ,
142
- proxyUsername : url . searchParams . get ( 'proxyUsername' ) ,
143
- proxyPassword : url . searchParams . get ( 'proxyPassword' )
144
- }
142
+ proxyHost : url . searchParams . get ( 'proxyHost' ) ,
143
+ proxyPort : Number ( url . searchParams . get ( 'proxyPort' ) ) ,
144
+ proxyUsername : url . searchParams . get ( 'proxyUsername' ) ,
145
+ proxyPassword : url . searchParams . get ( 'proxyPassword' )
146
+ }
145
147
: undefined
146
148
} ;
147
149
if ( url . username ) {
@@ -216,13 +218,13 @@ export class TestConfiguration {
216
218
}
217
219
218
220
newClient ( urlOrQueryOptions ?: string | Record < string , any > , serverOptions ?: MongoClientOptions ) {
219
- serverOptions = Object . assign (
220
- < MongoClientOptions > {
221
- compressors : this . compressor
222
- } ,
223
- getEnvironmentalOptions ( ) ,
224
- serverOptions
225
- ) ;
221
+ const baseOptions : MongoClientOptions = this . compressor
222
+ ? {
223
+ compressors : this . compressor
224
+ }
225
+ : { } ;
226
+
227
+ serverOptions = Object . assign ( baseOptions , getEnvironmentalOptions ( ) , serverOptions ) ;
226
228
227
229
if ( this . loggingEnabled && ! Object . hasOwn ( serverOptions , 'mongodbLogPath' ) ) {
228
230
serverOptions = this . setupLogging ( serverOptions ) ;
@@ -336,14 +338,12 @@ export class TestConfiguration {
336
338
authSource ?: string ;
337
339
authMechanism ?: string ;
338
340
authMechanismProperties ?: Record < string , any > ;
339
- compressors ?: CompressorName ;
340
341
}
341
342
) {
342
343
options = {
343
344
db : this . options . db ,
344
345
replicaSet : this . options . replicaSet ,
345
346
proxyURIParams : this . options . proxyURIParams ,
346
- compressors : this . compressor ,
347
347
...options
348
348
} ;
349
349
@@ -423,6 +423,8 @@ export class TestConfiguration {
423
423
url . searchParams . append ( 'authSource' , 'admin' ) ;
424
424
}
425
425
426
+ this . compressor && url . searchParams . append ( 'compressors' , this . compressor ) ;
427
+
426
428
// Secrets setup for OIDC always sets the workload URI as MONGODB_URI_SINGLE.
427
429
if ( process . env . MONGODB_URI_SINGLE ?. includes ( 'MONGODB-OIDC' ) ) {
428
430
return process . env . MONGODB_URI_SINGLE ;
0 commit comments