Skip to content

feat(NODE-6773): add support for $lookup on encrypted collections #4427

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 17 commits into from
Feb 28, 2025
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
chore: run on cryptd too
  • Loading branch information
nbbeeken committed Feb 26, 2025
commit aedae0c41f635773953d715e54943b19fb1892a0
2 changes: 2 additions & 0 deletions src/client-side-encryption/state_machine.ts
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,8 @@ export class StateMachine {

case MONGOCRYPT_CTX_NEED_MONGO_MARKINGS: {
const command = context.nextMongoOperation();
if (getState() === MONGOCRYPT_CTX_ERROR) break;

if (!mongocryptdClient) {
throw new MongoCryptError(
'unreachable state machine state: entered MONGOCRYPT_CTX_NEED_MONGO_MARKINGS but mongocryptdClient is undefined'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,7 @@ const newEncryptedClient = ({ configuration }: { configuration: TestConfiguratio
autoEncryption: {
keyVaultNamespace: 'db.keyvault',
kmsProviders: { local: getCSFLEKMSProviders().local },
extraOptions: {
cryptSharedLibPath: getEncryptExtraOptions().cryptSharedLibPath,
mongocryptdBypassSpawn: true,
cryptSharedLibRequired: true
}
extraOptions: getEncryptExtraOptions()
}
}
);
Expand Down Expand Up @@ -366,6 +362,22 @@ describe('$lookup support', defaultMetadata, function () {
let client: MongoClient;

beforeEach(async function () {
const mochaTest = {
metadata: defaultMetadata
} as unknown as Test;

if (!this.configuration.filters.MongoDBVersionFilter.filter(mochaTest)) {
return;
}

if (!this.configuration.filters.MongoDBTopologyFilter.filter(mochaTest)) {
return;
}

if (!this.configuration.filters.ClientSideEncryptionFilter.filter(mochaTest)) {
return;
}

const getMongoCrypt = sinon.stub(AutoEncrypter, 'getMongoCrypt').callsFake(function () {
const MongoCrypt = getMongoCrypt.wrappedMethod.call(this);
return class extends MongoCrypt {
Expand All @@ -384,19 +396,15 @@ describe('$lookup support', defaultMetadata, function () {
autoEncryption: {
keyVaultNamespace: 'db.keyvault',
kmsProviders: { local: getCSFLEKMSProviders().local },
extraOptions: {
cryptSharedLibPath: getEncryptExtraOptions().cryptSharedLibPath,
mongocryptdBypassSpawn: true,
cryptSharedLibRequired: true
}
extraOptions: getEncryptExtraOptions()
}
}
);
});

afterEach(async function () {
sinon.restore();
await client.close();
await client?.close();
});

it(
Expand Down