Skip to content

Commit 3c3e6e0

Browse files
asdf
1 parent 698f6ac commit 3c3e6e0

File tree

3 files changed

+35
-17
lines changed

3 files changed

+35
-17
lines changed

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -236,6 +236,10 @@ export class UnifiedMongoClient extends MongoClient {
236236
config.setupLogging?.(options, description.id);
237237
}
238238

239+
if (description.autoEncryptOpts) {
240+
options.autoEncryption = description.autoEncryptOpts;
241+
}
242+
239243
super(uri, options);
240244
this.observedEventEmitter.on('error', () => null);
241245
this.logCollector = logCollector;

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

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ async function runUnifiedTest(
8181
ctx.skip();
8282
}
8383

84-
let utilClient;
84+
let utilClient: MongoClient;
8585
if (ctx.configuration.isLoadBalanced) {
8686
// The util client can always point at the single mongos LB frontend.
8787
utilClient = ctx.configuration.newClient(ctx.configuration.singleMongosLoadBalancerUri);
@@ -147,12 +147,13 @@ async function runUnifiedTest(
147147
writeConcern: { w: 'majority' }
148148
});
149149

150-
trace('listCollections');
151-
const collectionList = await db.listCollections({ name: collectionName }).toArray();
152-
if (collectionList.length !== 0) {
153-
trace('drop');
154-
expect(await collection.drop()).to.be.true;
155-
}
150+
trace('drop');
151+
expect(
152+
await collection.drop({
153+
// Specifying any encrypted fields causes `collection.drop()` to drop the esoc and esc collections as well.
154+
encryptedFields: {}
155+
})
156+
).to.be.true;
156157
}
157158

158159
for (const {
@@ -262,10 +263,10 @@ async function runUnifiedTest(
262263
expect(testClient, `No client entity found with id ${clientId}`).to.exist;
263264
const filteredTestClientLogs = expectedLogsForClient.ignoreMessages
264265
? filterIgnoredMessages(
265-
expectedLogsForClient.ignoreMessages,
266-
testClient!.collectedLogs,
267-
entities
268-
)
266+
expectedLogsForClient.ignoreMessages,
267+
testClient!.collectedLogs,
268+
entities
269+
)
269270
: testClient!.collectedLogs;
270271
compareLogs(
271272
expectedLogsForClient.messages,

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

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import type {
22
Document,
3+
MongoClientOptions,
34
MongoLoggableComponent,
45
ObjectId,
56
ReadConcernLevel,
@@ -152,7 +153,19 @@ export interface ClientEntity {
152153
observeSensitiveCommands?: boolean;
153154
// Was optionally scheduled for removal in NODE-6783, but opted to keep it for potential future use.
154155
storeEventsAsEntities?: StoreEventsAsEntity[];
156+
autoEncryptOpts?: Pick<
157+
MongoClientOptions['autoEncryption'],
158+
| 'kmsProviders'
159+
| 'keyVaultNamespace'
160+
| 'bypassAutoEncryption'
161+
| 'schemaMap'
162+
| 'encryptedFieldsMap'
163+
| 'extraOptions'
164+
| 'bypassQueryAnalysis'
165+
| 'keyExpirationMS'
166+
>;
155167
}
168+
156169
export interface DatabaseEntity {
157170
id: string;
158171
client: string;
@@ -214,12 +227,12 @@ export interface ClientEncryptionEntity {
214227
keyVaultNamespace: string;
215228
kmsProviders: UnnamedKMSProviders & {
216229
[key: string]:
217-
| UnnamedKMSProviders['aws']
218-
| UnnamedKMSProviders['gcp']
219-
| UnnamedKMSProviders['azure']
220-
| UnnamedKMSProviders['kmip']
221-
| UnnamedKMSProviders['local']
222-
| undefined;
230+
| UnnamedKMSProviders['aws']
231+
| UnnamedKMSProviders['gcp']
232+
| UnnamedKMSProviders['azure']
233+
| UnnamedKMSProviders['kmip']
234+
| UnnamedKMSProviders['local']
235+
| undefined;
223236
};
224237
keyExpirationMS?: number;
225238
};

0 commit comments

Comments
 (0)