Skip to content

Commit 005b343

Browse files
incorporate changes
1 parent 2ffadda commit 005b343

File tree

9 files changed

+69
-140
lines changed

9 files changed

+69
-140
lines changed

.evergreen/config.in.yml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -475,8 +475,6 @@ functions:
475475
export AWS_CMK_ID='${AWS_CMK_ID}'
476476
export AWS_ACCESS_KEY_ID='${AWS_ACCESS_KEY_ID}'
477477
export AWS_SECRET_ACCESS_KEY='${AWS_SECRET_ACCESS_KEY}'
478-
export CSFLE_GIT_REF='${CSFLE_GIT_REF}'
479-
export CDRIVER_GIT_REF='${CDRIVER_GIT_REF}'
480478
EOT
481479
- command: shell.exec
482480
type: test
@@ -914,8 +912,6 @@ functions:
914912
export AWS_SECRET_ACCESS_KEY='${AWS_SECRET_ACCESS_KEY}'
915913
export AWS_REGION='${AWS_REGION}'
916914
export AWS_CMK_ID='${AWS_CMK_ID}'
917-
export CSFLE_GIT_REF='${CSFLE_GIT_REF}'
918-
export CDRIVER_GIT_REF='${CDRIVER_GIT_REF}'
919915
EOT
920916
- command: shell.exec
921917
type: test

.evergreen/config.yml

Lines changed: 6 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -428,8 +428,6 @@ functions:
428428
export AWS_CMK_ID='${AWS_CMK_ID}'
429429
export AWS_ACCESS_KEY_ID='${AWS_ACCESS_KEY_ID}'
430430
export AWS_SECRET_ACCESS_KEY='${AWS_SECRET_ACCESS_KEY}'
431-
export CSFLE_GIT_REF='${CSFLE_GIT_REF}'
432-
export CDRIVER_GIT_REF='${CDRIVER_GIT_REF}'
433431
EOT
434432
- command: shell.exec
435433
type: test
@@ -886,8 +884,6 @@ functions:
886884
export AWS_SECRET_ACCESS_KEY='${AWS_SECRET_ACCESS_KEY}'
887885
export AWS_REGION='${AWS_REGION}'
888886
export AWS_CMK_ID='${AWS_CMK_ID}'
889-
export CSFLE_GIT_REF='${CSFLE_GIT_REF}'
890-
export CDRIVER_GIT_REF='${CDRIVER_GIT_REF}'
891887
EOT
892888
- command: shell.exec
893889
type: test
@@ -3516,7 +3512,7 @@ tasks:
35163512
variant: '*'
35173513
status: '*'
35183514
patch_optional: true
3519-
- name: run-custom-csfle-tests-5.0-pinned-commit
3515+
- name: run-custom-csfle-tests-5.0
35203516
tags:
35213517
- run-custom-dependency-tests
35223518
commands:
@@ -3528,29 +3524,11 @@ tasks:
35283524
- {key: NPM_VERSION, value: '9'}
35293525
- {key: VERSION, value: '5.0'}
35303526
- {key: TOPOLOGY, value: replica_set}
3531-
- {key: CSFLE_GIT_REF, value: 974a4614f8c1c3786e5e39fa63568d83f4f69ebd}
35323527
- func: install dependencies
35333528
- func: bootstrap mongo-orchestration
35343529
- func: bootstrap kms servers
35353530
- func: run custom csfle tests
3536-
- name: run-custom-csfle-tests-5.0-master
3537-
tags:
3538-
- run-custom-dependency-tests
3539-
commands:
3540-
- command: expansions.update
3541-
type: setup
3542-
params:
3543-
updates:
3544-
- {key: NODE_LTS_VERSION, value: '16'}
3545-
- {key: NPM_VERSION, value: '9'}
3546-
- {key: VERSION, value: '5.0'}
3547-
- {key: TOPOLOGY, value: replica_set}
3548-
- {key: CSFLE_GIT_REF, value: master}
3549-
- func: install dependencies
3550-
- func: bootstrap mongo-orchestration
3551-
- func: bootstrap kms servers
3552-
- func: run custom csfle tests
3553-
- name: run-custom-csfle-tests-rapid-pinned-commit
3531+
- name: run-custom-csfle-tests-rapid
35543532
tags:
35553533
- run-custom-dependency-tests
35563534
commands:
@@ -3562,46 +3540,11 @@ tasks:
35623540
- {key: NPM_VERSION, value: '9'}
35633541
- {key: VERSION, value: rapid}
35643542
- {key: TOPOLOGY, value: replica_set}
3565-
- {key: CSFLE_GIT_REF, value: 974a4614f8c1c3786e5e39fa63568d83f4f69ebd}
3566-
- func: install dependencies
3567-
- func: bootstrap mongo-orchestration
3568-
- func: bootstrap kms servers
3569-
- func: run custom csfle tests
3570-
- name: run-custom-csfle-tests-rapid-master
3571-
tags:
3572-
- run-custom-dependency-tests
3573-
commands:
3574-
- command: expansions.update
3575-
type: setup
3576-
params:
3577-
updates:
3578-
- {key: NODE_LTS_VERSION, value: '16'}
3579-
- {key: NPM_VERSION, value: '9'}
3580-
- {key: VERSION, value: rapid}
3581-
- {key: TOPOLOGY, value: replica_set}
3582-
- {key: CSFLE_GIT_REF, value: master}
3583-
- func: install dependencies
3584-
- func: bootstrap mongo-orchestration
3585-
- func: bootstrap kms servers
3586-
- func: run custom csfle tests
3587-
- name: run-custom-csfle-tests-latest-pinned-commit
3588-
tags:
3589-
- run-custom-dependency-tests
3590-
commands:
3591-
- command: expansions.update
3592-
type: setup
3593-
params:
3594-
updates:
3595-
- {key: NODE_LTS_VERSION, value: '16'}
3596-
- {key: NPM_VERSION, value: '9'}
3597-
- {key: VERSION, value: latest}
3598-
- {key: TOPOLOGY, value: replica_set}
3599-
- {key: CSFLE_GIT_REF, value: 974a4614f8c1c3786e5e39fa63568d83f4f69ebd}
36003543
- func: install dependencies
36013544
- func: bootstrap mongo-orchestration
36023545
- func: bootstrap kms servers
36033546
- func: run custom csfle tests
3604-
- name: run-custom-csfle-tests-latest-master
3547+
- name: run-custom-csfle-tests-latest
36053548
tags:
36063549
- run-custom-dependency-tests
36073550
commands:
@@ -3613,7 +3556,6 @@ tasks:
36133556
- {key: NPM_VERSION, value: '9'}
36143557
- {key: VERSION, value: latest}
36153558
- {key: TOPOLOGY, value: replica_set}
3616-
- {key: CSFLE_GIT_REF, value: master}
36173559
- func: install dependencies
36183560
- func: bootstrap mongo-orchestration
36193561
- func: bootstrap kms servers
@@ -5118,12 +5060,9 @@ buildvariants:
51185060
display_name: Custom Dependency Version Test
51195061
run_on: rhel80-large
51205062
tasks:
5121-
- run-custom-csfle-tests-5.0-pinned-commit
5122-
- run-custom-csfle-tests-5.0-master
5123-
- run-custom-csfle-tests-rapid-pinned-commit
5124-
- run-custom-csfle-tests-rapid-master
5125-
- run-custom-csfle-tests-latest-pinned-commit
5126-
- run-custom-csfle-tests-latest-master
5063+
- run-custom-csfle-tests-5.0
5064+
- run-custom-csfle-tests-rapid
5065+
- run-custom-csfle-tests-latest
51275066
- test-latest-driver-mongodb-client-encryption-6.0.0
51285067
- name: rhel8-test-serverless
51295068
display_name: Serverless Test

.evergreen/generate_evergreen_tasks.js

Lines changed: 16 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -581,28 +581,23 @@ BUILD_VARIANTS.push({
581581

582582
const oneOffFuncAsTasks = [];
583583

584-
const FLE_PINNED_COMMIT = '974a4614f8c1c3786e5e39fa63568d83f4f69ebd';
585-
586584
for (const version of ['5.0', 'rapid', 'latest']) {
587-
for (const ref of [FLE_PINNED_COMMIT, 'master']) {
588-
oneOffFuncAsTasks.push({
589-
name: `run-custom-csfle-tests-${version}-${ref === 'master' ? ref : 'pinned-commit'}`,
590-
tags: ['run-custom-dependency-tests'],
591-
commands: [
592-
updateExpansions({
593-
NODE_LTS_VERSION: LOWEST_LTS,
594-
NPM_VERSION: 9,
595-
VERSION: version,
596-
TOPOLOGY: 'replica_set',
597-
CSFLE_GIT_REF: ref
598-
}),
599-
{ func: 'install dependencies' },
600-
{ func: 'bootstrap mongo-orchestration' },
601-
{ func: 'bootstrap kms servers' },
602-
{ func: 'run custom csfle tests' }
603-
]
604-
});
605-
}
585+
oneOffFuncAsTasks.push({
586+
name: `run-custom-csfle-tests-${version}`,
587+
tags: ['run-custom-dependency-tests'],
588+
commands: [
589+
updateExpansions({
590+
NODE_LTS_VERSION: LOWEST_LTS,
591+
NPM_VERSION: 9,
592+
VERSION: version,
593+
TOPOLOGY: 'replica_set',
594+
}),
595+
{ func: 'install dependencies' },
596+
{ func: 'bootstrap mongo-orchestration' },
597+
{ func: 'bootstrap kms servers' },
598+
{ func: 'run custom csfle tests' }
599+
]
600+
});
606601
}
607602

608603
oneOffFuncAsTasks.push({

.evergreen/run-custom-csfle-tests.sh

Lines changed: 1 addition & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -22,47 +22,7 @@ echo "adding temporary AWS credentials to environment"
2222
# CSFLE_AWS_TEMP_ACCESS_KEY_ID, CSFLE_AWS_TEMP_SECRET_ACCESS_KEY, CSFLE_AWS_TEMP_SESSION_TOKEN
2323
. "$DRIVERS_TOOLS"/.evergreen/csfle/set-temp-creds.sh
2424

25-
ABS_PATH_TO_PATCH=$(pwd)
26-
27-
# Environment Variables:
28-
# CSFLE_GIT_REF - set the git reference to checkout for a custom CSFLE version
29-
# CDRIVER_GIT_REF - set the git reference to checkout for a custom CDRIVER version (this is for libbson)
30-
CSFLE_GIT_REF=${CSFLE_GIT_REF:-master}
31-
CDRIVER_GIT_REF=${CDRIVER_GIT_REF:-1.17.6}
32-
33-
rm -rf ../csfle-deps-tmp
34-
mkdir -p ../csfle-deps-tmp
35-
pushd ../csfle-deps-tmp
36-
37-
rm -rf libmongocrypt mongo-c-driver
38-
39-
git clone https://github.com/mongodb/libmongocrypt.git
40-
pushd libmongocrypt
41-
git fetch --tags
42-
git checkout "$CSFLE_GIT_REF" -b csfle-custom
43-
echo "checked out libmongocrypt at $(git rev-parse HEAD)"
44-
popd # libmongocrypt
45-
46-
git clone https://github.com/mongodb/mongo-c-driver.git
47-
pushd mongo-c-driver
48-
git fetch --tags
49-
git checkout "$CDRIVER_GIT_REF" -b cdriver-custom
50-
echo "checked out C driver at $(git rev-parse HEAD)"
51-
popd # mongo-c-driver
52-
53-
pushd libmongocrypt/bindings/node
54-
55-
npm install --production --ignore-scripts
56-
bash ./etc/build-static.sh
57-
58-
npm run rebuild # just in case this is necessary?
59-
60-
BINDINGS_DIR=$(pwd)
61-
popd # libmongocrypt/bindings/node
62-
popd # ../csfle-deps-tmp
63-
64-
# copy mongodb-client-encryption into driver's node_modules
65-
npm link $BINDINGS_DIR
25+
npm i git+https://github.com/mongodb-js/mongodb-client-encryption.git
6626

6727
export MONGODB_URI=${MONGODB_URI}
6828
export KMIP_TLS_CA_FILE="${DRIVERS_TOOLS}/.evergreen/x509gen/ca.pem"

global.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ declare global {
1616
* of mongodb-client-encryption. Ex: `clientSideEncryption: '>=6.0.1'`
1717
*/
1818
clientSideEncryption?: string | true;
19+
libmongocrypt?: string;
1920
serverless?: 'forbid' | 'allow' | 'require';
2021
auth?: 'enabled' | 'disabled';
2122
idmsMockServer?: true;

test/integration/client-side-encryption/client_side_encryption.spec.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import * as path from 'path';
22

33
import { loadSpecTests } from '../../spec';
4-
import { ClientSideEncryptionFilter } from '../../tools/runner/filters/client_encryption_filter';
4+
import { LibmongocryptVersionFilter } from '../../tools/runner/filters/client_encryption_filter';
55
import { installNodeDNSWorkaroundHooks } from '../../tools/runner/hooks/configuration';
66
import {
77
gatherTestSuites,
@@ -61,7 +61,7 @@ const SKIPPED_TESTS = new Set([
6161

6262
const isServerless = !!process.env.SERVERLESS;
6363

64-
const filter = new ClientSideEncryptionFilter();
64+
const filter = new LibmongocryptVersionFilter();
6565

6666
describe('Client Side Encryption (Legacy)', function () {
6767
const testContext = new TestRunnerContext({ requiresCSFLE: true });

test/integration/node-specific/client_encryption.test.ts

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,14 @@ import * as sinon from 'sinon';
44

55
/* eslint-disable @typescript-eslint/no-restricted-imports */
66
import {
7-
ClientEncryption,
8-
type DataKey
7+
type DataKey,
8+
ClientEncryption
99
} from '../../../src/client-side-encryption/client_encryption';
1010
/* eslint-disable @typescript-eslint/no-restricted-imports */
1111
import { MongoCryptInvalidArgumentError } from '../../../src/client-side-encryption/errors';
1212
/* eslint-disable @typescript-eslint/no-restricted-imports */
1313
import { StateMachine } from '../../../src/client-side-encryption/state_machine';
14-
import { Binary, type Collection, Int32, Long, type MongoClient, UUID } from '../../mongodb';
14+
import { type Collection, type MongoClient, Binary, Int32, Long, UUID } from '../../mongodb';
1515

1616
function readHttpResponse(path) {
1717
let data = readFileSync(path, 'utf8').toString();
@@ -335,7 +335,11 @@ describe('ClientEncryption integration tests', function () {
335335
context('when expressionMode is incorrectly provided as an argument', function () {
336336
it(
337337
'overrides the provided option with the correct value for expression mode',
338-
metadata,
338+
{
339+
requires: {
340+
libmongocrypt: '<1.10.0'
341+
}
342+
},
339343
async function () {
340344
const optionsWithExpressionMode = { ...completeOptions, expressionMode: true };
341345
const result = await clientEncryption.encrypt(new Long(0), optionsWithExpressionMode);

test/tools/runner/filters/client_encryption_filter.ts

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,3 +88,33 @@ export class ClientSideEncryptionFilter extends Filter {
8888
: `requires mongodb-client-encryption ${validRange}, received ${ClientSideEncryptionFilter.version}`;
8989
}
9090
}
91+
92+
export class LibmongocryptVersionFilter extends Filter {
93+
clientSideEncryptionFilter = new ClientSideEncryptionFilter();
94+
override async initializeFilter(client: MongoClient, context: Record<string, any>) {
95+
await this.clientSideEncryptionFilter.initializeFilter(client, context);
96+
}
97+
98+
filter(test: { metadata?: MongoDBMetadataUI }) {
99+
const clientSideEncryption =
100+
test.metadata && test.metadata.requires && test.metadata.requires.libmongocrypt;
101+
102+
if (clientSideEncryption == null) {
103+
return true;
104+
}
105+
106+
if (
107+
!this.clientSideEncryptionFilter.filter({
108+
metadata: { requires: { clientSideEncryption: true } }
109+
})
110+
) {
111+
return `no mongodb-client-encryption installed, but test requires a libmongocrypt version.`;
112+
}
113+
// eslint-disable-next-line @typescript-eslint/no-var-requires
114+
const version = require('mongodb-client-encryption').MongoCrypt.libmongocryptVersion;
115+
116+
return satisfies(version, clientSideEncryption, {
117+
includePrerelease: true
118+
});
119+
}
120+
}

test/tools/runner/hooks/configuration.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,10 @@ import { coerce, gte } from 'semver';
1616

1717
import { ApiVersionFilter } from '../filters/api_version_filter';
1818
import { AuthFilter } from '../filters/auth_filter';
19-
import { ClientSideEncryptionFilter } from '../filters/client_encryption_filter';
19+
import {
20+
ClientSideEncryptionFilter,
21+
LibmongocryptVersionFilter
22+
} from '../filters/client_encryption_filter';
2023
import { GenericPredicateFilter } from '../filters/generic_predicate_filter';
2124
import { IDMSMockServerFilter } from '../filters/idms_mock_server_filter';
2225
import { MongoDBTopologyFilter } from '../filters/mongodb_topology_filter';
@@ -60,6 +63,7 @@ async function initializeFilters(client): Promise<Record<string, any>> {
6063
new ApiVersionFilter(),
6164
new AuthFilter(),
6265
new ClientSideEncryptionFilter(),
66+
new LibmongocryptVersionFilter(),
6367
new GenericPredicateFilter(),
6468
new IDMSMockServerFilter(),
6569
new MongoDBTopologyFilter(),

0 commit comments

Comments
 (0)