Skip to content

Commit 2cba79d

Browse files
test with compression
1 parent cb6a7ba commit 2cba79d

File tree

2 files changed

+11
-7
lines changed

2 files changed

+11
-7
lines changed

src/cmap/stream_description.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,6 @@ export class StreamDescription {
9191
return Long.isLong(serverConnectionId)
9292
? serverConnectionId.toBigInt()
9393
: // @ts-expect-error: Doubles are coercible to number
94-
BigInt(serverConnectionId);
94+
BigInt(serverConnectionId);
9595
}
9696
}

test/tools/runner/config.ts

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import * as url from 'url';
55

66
import {
77
type AuthMechanism,
8+
CompressorName,
89
HostAddress,
910
MongoClient,
1011
type MongoClientOptions,
@@ -85,6 +86,7 @@ export class TestConfiguration {
8586
serverApi?: ServerApi;
8687
activeResources: number;
8788
isSrv: boolean;
89+
compressors: CompressorName[];
8890

8991
constructor(
9092
private uri: string,
@@ -116,11 +118,11 @@ export class TestConfiguration {
116118
replicaSet: url.searchParams.get('replicaSet'),
117119
proxyURIParams: url.searchParams.get('proxyHost')
118120
? {
119-
proxyHost: url.searchParams.get('proxyHost'),
120-
proxyPort: Number(url.searchParams.get('proxyPort')),
121-
proxyUsername: url.searchParams.get('proxyUsername'),
122-
proxyPassword: url.searchParams.get('proxyPassword')
123-
}
121+
proxyHost: url.searchParams.get('proxyHost'),
122+
proxyPort: Number(url.searchParams.get('proxyPort')),
123+
proxyUsername: url.searchParams.get('proxyUsername'),
124+
proxyPassword: url.searchParams.get('proxyPassword')
125+
}
124126
: undefined
125127
};
126128
if (url.username) {
@@ -133,6 +135,7 @@ export class TestConfiguration {
133135
const { username, password } = context.serverlessCredentials;
134136
this.options.auth = { username, password, authSource: 'admin' };
135137
}
138+
this.compressors = url.searchParams.getAll('compressors') as CompressorName[];
136139
}
137140

138141
get isLoadBalanced() {
@@ -197,7 +200,8 @@ export class TestConfiguration {
197200
}
198201

199202
newClient(urlOrQueryOptions?: string | Record<string, any>, serverOptions?: MongoClientOptions) {
200-
serverOptions = Object.assign({}, getEnvironmentalOptions(), serverOptions);
203+
const baseOptions = this.compressors.length > 0 ? { compressors: this.compressors } : {}
204+
serverOptions = Object.assign(baseOptions, getEnvironmentalOptions(), serverOptions);
201205
// Support MongoClient constructor form (url, options) for `newClient`.
202206
if (typeof urlOrQueryOptions === 'string') {
203207
if (Reflect.has(serverOptions, 'host') || Reflect.has(serverOptions, 'port')) {

0 commit comments

Comments
 (0)