Skip to content

Commit 4f797c9

Browse files
committed
chore: run on cryptd too
1 parent 99a6130 commit 4f797c9

File tree

2 files changed

+21
-11
lines changed

2 files changed

+21
-11
lines changed

src/client-side-encryption/state_machine.ts

+2
Original file line numberDiff line numberDiff line change
@@ -247,6 +247,8 @@ export class StateMachine {
247247

248248
case MONGOCRYPT_CTX_NEED_MONGO_MARKINGS: {
249249
const command = context.nextMongoOperation();
250+
if (getState() === MONGOCRYPT_CTX_ERROR) break;
251+
250252
if (!mongocryptdClient) {
251253
throw new MongoCryptError(
252254
'unreachable state machine state: entered MONGOCRYPT_CTX_NEED_MONGO_MARKINGS but mongocryptdClient is undefined'

test/integration/client-side-encryption/client_side_encryption.prose.25.lookup.test.ts

+19-11
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,7 @@ const newEncryptedClient = ({ configuration }: { configuration: TestConfiguratio
3434
autoEncryption: {
3535
keyVaultNamespace: 'db.keyvault',
3636
kmsProviders: { local: getCSFLEKMSProviders().local },
37-
extraOptions: {
38-
cryptSharedLibPath: getEncryptExtraOptions().cryptSharedLibPath,
39-
mongocryptdBypassSpawn: true,
40-
cryptSharedLibRequired: true
41-
}
37+
extraOptions: getEncryptExtraOptions()
4238
}
4339
}
4440
);
@@ -366,6 +362,22 @@ describe('$lookup support', defaultMetadata, function () {
366362
let client: MongoClient;
367363

368364
beforeEach(async function () {
365+
const mochaTest = {
366+
metadata: defaultMetadata
367+
} as unknown as Test;
368+
369+
if (!this.configuration.filters.MongoDBVersionFilter.filter(mochaTest)) {
370+
return;
371+
}
372+
373+
if (!this.configuration.filters.MongoDBTopologyFilter.filter(mochaTest)) {
374+
return;
375+
}
376+
377+
if (!this.configuration.filters.ClientSideEncryptionFilter.filter(mochaTest)) {
378+
return;
379+
}
380+
369381
const getMongoCrypt = sinon.stub(AutoEncrypter, 'getMongoCrypt').callsFake(function () {
370382
const MongoCrypt = getMongoCrypt.wrappedMethod.call(this);
371383
return class extends MongoCrypt {
@@ -384,19 +396,15 @@ describe('$lookup support', defaultMetadata, function () {
384396
autoEncryption: {
385397
keyVaultNamespace: 'db.keyvault',
386398
kmsProviders: { local: getCSFLEKMSProviders().local },
387-
extraOptions: {
388-
cryptSharedLibPath: getEncryptExtraOptions().cryptSharedLibPath,
389-
mongocryptdBypassSpawn: true,
390-
cryptSharedLibRequired: true
391-
}
399+
extraOptions: getEncryptExtraOptions()
392400
}
393401
}
394402
);
395403
});
396404

397405
afterEach(async function () {
398406
sinon.restore();
399-
await client.close();
407+
await client?.close();
400408
});
401409

402410
it(

0 commit comments

Comments
 (0)