From 6b7e18657d95dc543e1c0dec8d1bf6763a4f43c1 Mon Sep 17 00:00:00 2001 From: Bailey Pearson Date: Fri, 11 Aug 2023 12:59:19 -0600 Subject: [PATCH] ci(NODE-5424): add CI testing for FLE 6.0 with driver latest (#3802) Co-authored-by: Durran Jordan --- .evergreen/config.in.yml | 7 ++++ .evergreen/config.yml | 27 +++++++++++++ .evergreen/generate_evergreen_tasks.js | 40 +++++++++++++++---- package-lock.json | 10 ++--- package.json | 4 +- .../filters/client_encryption_filter.js | 11 ++++- test/tools/runner/hooks/configuration.js | 5 ++- 7 files changed, 88 insertions(+), 16 deletions(-) diff --git a/.evergreen/config.in.yml b/.evergreen/config.in.yml index df9df455f7..a34f710b8e 100644 --- a/.evergreen/config.in.yml +++ b/.evergreen/config.in.yml @@ -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 diff --git a/.evergreen/config.yml b/.evergreen/config.yml index 55d2fef4b0..058475c86d 100644 --- a/.evergreen/config.yml +++ b/.evergreen/config.yml @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 diff --git a/.evergreen/generate_evergreen_tasks.js b/.evergreen/generate_evergreen_tasks.js index 46224a0811..236ee2cb8d 100644 --- a/.evergreen/generate_evergreen_tasks.js +++ b/.evergreen/generate_evergreen_tasks.js @@ -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: [], @@ -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) diff --git a/package-lock.json b/package-lock.json index 43885a88c9..8cb0d5b308 100644 --- a/package-lock.json +++ b/package-lock.json @@ -47,7 +47,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", @@ -75,7 +75,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" }, @@ -6629,9 +6629,9 @@ } }, "node_modules/mongodb-client-encryption": { - "version": "6.0.0-alpha.1", - "resolved": "https://registry.npmjs.org/mongodb-client-encryption/-/mongodb-client-encryption-6.0.0-alpha.1.tgz", - "integrity": "sha512-SaYli844l5TN8oog4nJW8KKWpSPwSx2auojv30JtDQv8hgWV979Bnc4bwF2pf+R9fquqgoLr27CWxganGY0Zfg==", + "version": "6.0.0-alpha.3", + "resolved": "https://registry.npmjs.org/mongodb-client-encryption/-/mongodb-client-encryption-6.0.0-alpha.3.tgz", + "integrity": "sha512-4mMs1SHfeE7c69xzqzXEC8psx8mh1o+6DOuXgft83RkBAIaI/YwfnHAHKxYH1KtwEmq60CK3tE3fai+JZjh8BA==", "dev": true, "hasInstallScript": true, "dependencies": { diff --git a/package.json b/package.json index c9e4b1f982..a0e3971fa4 100644 --- a/package.json +++ b/package.json @@ -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" }, @@ -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", diff --git a/test/tools/runner/filters/client_encryption_filter.js b/test/tools/runner/filters/client_encryption_filter.js index d811c574b1..2cc20262e6 100644 --- a/test/tools/runner/filters/client_encryption_filter.js +++ b/test/tools/runner/filters/client_encryption_filter.js @@ -1,5 +1,7 @@ 'use strict'; +const { readFileSync } = require('fs'); +const { resolve } = require('path'); const process = require('process'); /** @@ -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(); diff --git a/test/tools/runner/hooks/configuration.js b/test/tools/runner/hooks/configuration.js index f07da9e294..0aeb0966d2 100644 --- a/test/tools/runner/hooks/configuration.js +++ b/test/tools/runner/hooks/configuration.js @@ -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'),