Skip to content

Commit 8f926dc

Browse files
committed
test(NODE-4224): fix spec runner with encrypted fields
1 parent f835608 commit 8f926dc

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

test/tools/spec-runner/index.js

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,13 @@ function prepareDatabaseForSuite(suite, context) {
261261

262262
const coll = db.collection(context.collectionName);
263263
return setupPromise
264-
.then(() => coll.drop({ writeConcern: { w: 'majority' } }))
264+
.then(() => {
265+
const options = { writeConcern: { w: 'majority' } };
266+
if (suite.encrypted_fields) {
267+
options.encryptedFields = suite.encrypted_fields;
268+
};
269+
coll.drop(options);
270+
})
265271
.catch(err => {
266272
if (!err.message.match(/ns not found/)) throw err;
267273
})
@@ -289,6 +295,9 @@ function prepareDatabaseForSuite(suite, context) {
289295
if (suite.json_schema) {
290296
options.validator = { $jsonSchema: suite.json_schema };
291297
}
298+
if (suite.encrypted_fields) {
299+
options.encryptedFields = suite.encrypted_fields;
300+
}
292301

293302
return db.createCollection(context.collectionName, options);
294303
})

0 commit comments

Comments
 (0)