Skip to content

Commit

Permalink
ci(NODE-5424): add CI testing for FLE 6.0 with driver latest (#3802)
Browse files Browse the repository at this point in the history
Co-authored-by: Durran Jordan <durran@gmail.com>
  • Loading branch information
baileympearson and durran committed Aug 11, 2023
1 parent 1e96e49 commit 6b7e186
Show file tree
Hide file tree
Showing 7 changed files with 88 additions and 16 deletions.
7 changes: 7 additions & 0 deletions .evergreen/config.in.yml
Original file line number Diff line number Diff line change
Expand Up @@ -352,6 +352,13 @@ functions:
SKIP_DEPS=${SKIP_DEPS|1} \
bash ${PROJECT_DIRECTORY}/.evergreen/run-tests.sh
"install package":
- command: shell.exec
params:
working_dir: src
script: |
npm install --force ${PACKAGE}
"run lint checks":
- command: subprocess.exec
type: test
Expand Down
27 changes: 27 additions & 0 deletions .evergreen/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -316,6 +316,12 @@ functions:
COMPRESSOR="${COMPRESSOR}" \
SKIP_DEPS=${SKIP_DEPS|1} \
bash ${PROJECT_DIRECTORY}/.evergreen/run-tests.sh
install package:
- command: shell.exec
params:
working_dir: src
script: |
npm install --force ${PACKAGE}
run lint checks:
- command: subprocess.exec
type: test
Expand Down Expand Up @@ -2745,6 +2751,24 @@ tasks:
- func: run custom csfle tests
vars:
CSFLE_GIT_REF: master
- name: test-latest-driver-mongodb-client-encryption-6.0.0
tags:
- run-custom-dependency-tests
commands:
- func: install dependencies
vars:
NODE_LTS_VERSION: 16
- func: bootstrap mongo-orchestration
vars:
VERSION: '7.0'
TOPOLOGY: replica_set
- func: bootstrap kms servers
- func: install package
vars:
PACKAGE: mongodb-client-encryption@6.0.0-alpha.3
- func: run tests
vars:
CLIENT_ENCRYPTION: true
- name: test-latest-server-noauth
tags:
- latest
Expand Down Expand Up @@ -3676,6 +3700,7 @@ buildvariants:
- test-auth-ldap
- test-auth-oidc
- test-socks5
- test-socks5-csfle
- test-socks5-tls
- test-tls-support-latest
- test-tls-support-6.0
Expand Down Expand Up @@ -3726,6 +3751,7 @@ buildvariants:
- test-auth-ldap
- test-auth-oidc
- test-socks5
- test-socks5-csfle
- test-socks5-tls
- test-tls-support-latest
- test-tls-support-6.0
Expand Down Expand Up @@ -4015,6 +4041,7 @@ buildvariants:
- run-custom-csfle-tests-rapid-master
- run-custom-csfle-tests-latest-pinned-commit
- run-custom-csfle-tests-latest-master
- test-latest-driver-mongodb-client-encryption-6.0.0
- name: rhel8-test-serverless
display_name: Serverless Test
run_on: rhel80-large
Expand Down
40 changes: 33 additions & 7 deletions .evergreen/generate_evergreen_tasks.js
Original file line number Diff line number Diff line change
Expand Up @@ -677,6 +677,39 @@ for (const version of ['5.0', 'rapid', 'latest']) {
}
}

oneOffFuncAsTasks.push({
name: `test-latest-driver-mongodb-client-encryption-6.0.0`,
tags: ['run-custom-dependency-tests'],
commands: [
{
func: 'install dependencies',
vars: {
NODE_LTS_VERSION: LOWEST_LTS
}
},
{
func: 'bootstrap mongo-orchestration',
vars: {
VERSION: '7.0',
TOPOLOGY: 'replica_set'
}
},
{ func: 'bootstrap kms servers' },
{
func: 'install package',
vars: {
PACKAGE: 'mongodb-client-encryption@6.0.0-alpha.3'
}
},
{
func: 'run tests',
vars: {
CLIENT_ENCRYPTION: true
}
}
]
});

const coverageTask = {
name: 'download and merge coverage'.split(' ').join('-'),
tags: [],
Expand Down Expand Up @@ -781,13 +814,6 @@ for (const variant of BUILD_VARIANTS.filter(
variant.tasks = variant.tasks.filter(name => !['test-socks5'].includes(name));
}

// TODO(NODE-5283): fix socks5 fle tests on node 20+
for (const variant of BUILD_VARIANTS.filter(
variant => variant.expansions && [20].includes(variant.expansions.NODE_LTS_VERSION)
) ) {
variant.tasks = variant.tasks.filter(name => !['test-socks5-csfle'].includes(name));
}

const fileData = yaml.load(fs.readFileSync(`${__dirname}/config.in.yml`, 'utf8'));
fileData.tasks = (fileData.tasks || [])
.concat(BASE_TASKS)
Expand Down
10 changes: 5 additions & 5 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
"@mongodb-js/zstd": "^1.1.0",
"gcp-metadata": "^5.2.0",
"kerberos": "^2.0.1",
"mongodb-client-encryption": ">=6.0.0-alpha.1 <7",
"mongodb-client-encryption": ">=6.0.0-alpha.3 <7",
"snappy": "^7.2.2",
"socks": "^2.7.1"
},
Expand Down Expand Up @@ -98,7 +98,7 @@
"js-yaml": "^4.1.0",
"mocha": "^10.2.0",
"mocha-sinon": "^2.1.2",
"mongodb-client-encryption": "6.0.0-alpha.1",
"mongodb-client-encryption": "6.0.0-alpha.3",
"mongodb-legacy": "^5.0.0",
"nyc": "^15.1.0",
"prettier": "^2.8.8",
Expand Down
11 changes: 10 additions & 1 deletion test/tools/runner/filters/client_encryption_filter.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
'use strict';

const { readFileSync } = require('fs');
const { resolve } = require('path');
const process = require('process');

/**
Expand All @@ -25,13 +27,20 @@ class ClientSideEncryptionFilter {
}
}

const { version } = JSON.parse(
readFileSync(
resolve(__dirname, '../../../../node_modules/mongodb-client-encryption', 'package.json')
)
);

this.enabled = !!(CSFLE_KMS_PROVIDERS && mongodbClientEncryption);

// Adds these fields onto the context so that they can be reused by tests
context.clientSideEncryption = {
enabled: this.enabled,
mongodbClientEncryption,
CSFLE_KMS_PROVIDERS
CSFLE_KMS_PROVIDERS,
version
};

callback();
Expand Down
5 changes: 4 additions & 1 deletion test/tools/runner/hooks/configuration.js
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,10 @@ const testConfigBeforeHook = async function () {
serverless: process.env.SERVERLESS === '1',
auth: process.env.AUTH === 'auth',
tls: process.env.SSL === 'ssl',
csfle: this.configuration.clientSideEncryption.enabled,
csfle: {
enabled: this.configuration.clientSideEncryption.enabled,
version: this.configuration.clientSideEncryption.version
},
serverApi: MONGODB_API_VERSION,
atlas: process.env.ATLAS_CONNECTIVITY != null,
aws: MONGODB_URI.includes('authMechanism=MONGODB-AWS'),
Expand Down

0 comments on commit 6b7e186

Please sign in to comment.