Skip to content

Commit 11e643a

Browse files
last fixes
1 parent 6ace236 commit 11e643a

File tree

5 files changed

+37
-23
lines changed

5 files changed

+37
-23
lines changed

test/spec/unified-test-format/valid-pass/poc-queryable-encryption.json

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,12 @@
44
"runOnRequirements": [
55
{
66
"minServerVersion": "7.0",
7-
"csfle": true
7+
"csfle": true,
8+
"topologies": [
9+
"replicaset",
10+
"load-balanced",
11+
"sharded"
12+
]
813
}
914
],
1015
"createEntities": [

test/spec/unified-test-format/valid-pass/poc-queryable-encryption.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ schemaVersion: "1.23"
55
runOnRequirements:
66
- minServerVersion: "7.0"
77
csfle: true
8+
# QE is not supported on standalone servers
9+
topologies: [ replicaset, load-balanced, sharded ]
810

911
createEntities:
1012
- client:

test/tools/runner/config.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -538,6 +538,12 @@ export class AstrolabeTestConfiguration extends TestConfiguration {
538538
}
539539

540540
export class AlpineTestConfiguration extends TestConfiguration {
541+
get encryptDefaultExtraOptions(): MongoClientOptions['autoEncryption']['extraOptions'] {
542+
return {
543+
mongocryptdBypassSpawn: true,
544+
mongocryptdURI: process.env.MONGOCRYPTD_URI
545+
};
546+
}
541547
override newClient(
542548
urlOrQueryOptions?: string | Record<string, any>,
543549
serverOptions?: MongoClientOptions
@@ -547,8 +553,7 @@ export class AlpineTestConfiguration extends TestConfiguration {
547553
if (options.autoEncryption) {
548554
const extraOptions: MongoClientOptions['autoEncryption']['extraOptions'] = {
549555
...options.autoEncryption.extraOptions,
550-
mongocryptdBypassSpawn: true,
551-
mongocryptdURI: process.env.MONGOCRYPTD_URI
556+
...this.encryptDefaultExtraOptions
552557
};
553558
options.autoEncryption.extraOptions = extraOptions;
554559
}

test/tools/unified-spec-runner/entities.ts

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ import {
4646
WriteConcern
4747
} from '../../mongodb';
4848
import { getEncryptExtraOptions, getEnvironmentalOptions } from '../../tools/utils';
49-
import type { TestConfiguration } from '../runner/config';
49+
import { AlpineTestConfiguration, type TestConfiguration } from '../runner/config';
5050
import { EntityEventRegistry } from './entity_event_registry';
5151
import { trace } from './runner';
5252
import 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
}

test/tools/unified-spec-runner/match.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -758,6 +758,8 @@ function isMongoCryptError(err): boolean {
758758
if (err.constructor.name === 'MongoCryptError') {
759759
return true;
760760
}
761+
762+
// TODO(NODE-7043): remove special handling for FLE errors in the UTR
761763
if (
762764
err instanceof TypeError &&
763765
err.message.includes(

0 commit comments

Comments
 (0)