Skip to content

Commit 9a64369

Browse files
committed
test: Add evergreen target for custom FLE version tests
1 parent ea70d8f commit 9a64369

File tree

4 files changed

+154
-40
lines changed

4 files changed

+154
-40
lines changed

.evergreen/config.yml

Lines changed: 44 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -436,6 +436,33 @@ functions:
436436
-p 8100 \
437437
-v \
438438
--fault revoked
439+
run custom csfle tests:
440+
- command: shell.exec
441+
type: test
442+
params:
443+
silent: true
444+
working_dir: src
445+
script: |
446+
cat <<EOT > prepare_client_encryption.sh
447+
export CLIENT_ENCRYPTION=${CLIENT_ENCRYPTION}
448+
export CSFLE_KMS_PROVIDERS='${CSFLE_KMS_PROVIDERS}'
449+
export AWS_ACCESS_KEY_ID="${AWS_ACCESS_KEY_ID}"
450+
export AWS_SECRET_ACCESS_KEY="${AWS_SECRET_ACCESS_KEY}"
451+
EOT
452+
- command: shell.exec
453+
type: test
454+
params:
455+
working_dir: src
456+
timeout_secs: 60
457+
script: |
458+
${PREPARE_SHELL}
459+
460+
# Disable xtrace (just in case it was accidentally set).
461+
set +x
462+
. ./prepare_client_encryption.sh
463+
rm -f ./prepare_client_encryption.sh
464+
465+
UNIFIED=${UNIFIED} MONGODB_URI="${MONGODB_URI}" bash ${PROJECT_DIRECTORY}/.evergreen/run-custom-csfle-tests.sh
439466
upload test results:
440467
- command: attach.xunit_results
441468
params:
@@ -1387,6 +1414,18 @@ tasks:
13871414
vars:
13881415
NODE_LTS_NAME: erbium
13891416
- func: run checks
1417+
- name: run-custom-csfle-tests
1418+
tags:
1419+
- run-custom-csfle-tests
1420+
commands:
1421+
- func: install dependencies
1422+
vars:
1423+
NODE_LTS_NAME: erbium
1424+
- func: bootstrap mongo-orchestration
1425+
vars:
1426+
VERSION: '4.4'
1427+
TOPOLOGY: server
1428+
- func: run custom csfle tests
13901429
buildvariants:
13911430
- name: macos-1014-erbium
13921431
display_name: macOS 10.14 Node Erbium
@@ -1468,12 +1507,6 @@ buildvariants:
14681507
- test-4.4-ocsp-soft-fail
14691508
- test-4.4-ocsp-malicious-invalid-cert-mustStaple-server-does-not-staple
14701509
- test-4.4-ocsp-malicious-no-responder-mustStaple-server-does-not-staple
1471-
- name: macos-1014-fermium
1472-
display_name: macOS 10.14 Node Fermium
1473-
run_on: macos-1014
1474-
expansions:
1475-
NODE_LTS_NAME: fermium
1476-
tasks: *ref_0
14771510
- name: macos-1014-dubnium
14781511
display_name: macOS 10.14 Node Dubnium
14791512
run_on: macos-1014
@@ -1578,12 +1611,6 @@ buildvariants:
15781611
- test-4.4-ocsp-soft-fail
15791612
- test-4.4-ocsp-malicious-invalid-cert-mustStaple-server-does-not-staple
15801613
- test-4.4-ocsp-malicious-no-responder-mustStaple-server-does-not-staple
1581-
- name: rhel70-fermium
1582-
display_name: RHEL 7.0 Node Fermium
1583-
run_on: rhel70-small
1584-
expansions:
1585-
NODE_LTS_NAME: fermium
1586-
tasks: *ref_1
15871614
- name: rhel70-dubnium
15881615
display_name: RHEL 7.0 Node Dubnium
15891616
run_on: rhel70-small
@@ -1654,12 +1681,6 @@ buildvariants:
16541681
- test-auth-kerberos-legacy
16551682
- test-auth-kerberos-unified
16561683
- test-auth-ldap
1657-
- name: ubuntu-14.04-fermium
1658-
display_name: Ubuntu 14.04 Node Fermium
1659-
run_on: ubuntu1404-test
1660-
expansions:
1661-
NODE_LTS_NAME: fermium
1662-
tasks: *ref_2
16631684
- name: ubuntu-14.04-dubnium
16641685
display_name: Ubuntu 14.04 Node Dubnium
16651686
run_on: ubuntu1404-test
@@ -1753,13 +1774,6 @@ buildvariants:
17531774
- test-4.4-ocsp-soft-fail
17541775
- test-4.4-ocsp-malicious-invalid-cert-mustStaple-server-does-not-staple
17551776
- test-4.4-ocsp-malicious-no-responder-mustStaple-server-does-not-staple
1756-
- name: ubuntu-18.04-fermium
1757-
display_name: Ubuntu 18.04 Node Fermium
1758-
run_on: ubuntu1804-test
1759-
expansions:
1760-
NODE_LTS_NAME: fermium
1761-
CLIENT_ENCRYPTION: true
1762-
tasks: *ref_3
17631777
- name: ubuntu-18.04-dubnium
17641778
display_name: Ubuntu 18.04 Node Dubnium
17651779
run_on: ubuntu1804-test
@@ -1852,13 +1866,6 @@ buildvariants:
18521866
NODE_LTS_NAME: argon
18531867
MSVS_VERSION: 2013
18541868
tasks: *ref_4
1855-
- name: windows-64-vs2015-fermium
1856-
display_name: Windows (VS2015) Node Fermium
1857-
run_on: windows-64-vs2015-large
1858-
expansions:
1859-
NODE_LTS_NAME: fermium
1860-
MSVS_VERSION: 2015
1861-
tasks: *ref_4
18621869
- name: windows-64-vs2015-erbium
18631870
display_name: Windows (VS2015) Node Erbium
18641871
run_on: windows-64-vs2015-large
@@ -1894,13 +1901,6 @@ buildvariants:
18941901
NODE_LTS_NAME: argon
18951902
MSVS_VERSION: 2015
18961903
tasks: *ref_4
1897-
- name: windows-64-vs2017-fermium
1898-
display_name: Windows (VS2017) Node Fermium
1899-
run_on: windows-64-vs2017-large
1900-
expansions:
1901-
NODE_LTS_NAME: fermium
1902-
MSVS_VERSION: 2017
1903-
tasks: *ref_4
19041904
- name: windows-64-vs2017-erbium
19051905
display_name: Windows (VS2017) Node Erbium
19061906
run_on: windows-64-vs2017-large
@@ -1941,6 +1941,11 @@ buildvariants:
19411941
run_on: rhel70
19421942
tasks:
19431943
- run-checks
1944+
- name: ubuntu1804-custom-csfle-tests
1945+
display_name: Custom FLE Test
1946+
run_on: ubuntu1804-test
1947+
tasks:
1948+
- run-custom-csfle-tests
19441949
- name: ubuntu1804-test-mongodb-aws
19451950
display_name: MONGODB-AWS Auth test
19461951
run_on: ubuntu1804-test

.evergreen/config.yml.in

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ functions:
195195
bash ${PROJECT_DIRECTORY}/.evergreen/install-dependencies.sh
196196
- command: expansions.update
197197
params:
198-
file: src/deps-expansion.yml
198+
file: src/deps-expansion.yml
199199

200200
"run atlas tests":
201201
- command: shell.exec
@@ -476,6 +476,37 @@ functions:
476476
-v \
477477
--fault revoked
478478

479+
"run custom csfle tests":
480+
- command: shell.exec
481+
type: test
482+
params:
483+
silent: true
484+
working_dir: "src"
485+
script: |
486+
${PREPARE_SHELL}
487+
cat <<EOT > prepare_client_encryption.sh
488+
export CLIENT_ENCRYPTION=${CLIENT_ENCRYPTION}
489+
export CSFLE_KMS_PROVIDERS='${CSFLE_KMS_PROVIDERS}'
490+
export AWS_ACCESS_KEY_ID="${AWS_ACCESS_KEY_ID}"
491+
export AWS_SECRET_ACCESS_KEY="${AWS_SECRET_ACCESS_KEY}"
492+
export CSFLE_GIT_REF="${CSFLE_GIT_REF}"
493+
export CDRIVER_GIT_REF="${CDRIVER_GIT_REF}"
494+
EOT
495+
- command: shell.exec
496+
type: test
497+
params:
498+
working_dir: "src"
499+
timeout_secs: 60
500+
script: |
501+
${PREPARE_SHELL}
502+
503+
# Disable xtrace (just in case it was accidentally set).
504+
set +x
505+
. ./prepare_client_encryption.sh
506+
rm -f ./prepare_client_encryption.sh
507+
508+
UNIFIED=${UNIFIED} MONGODB_URI="${MONGODB_URI}" bash ${PROJECT_DIRECTORY}/.evergreen/run-custom-csfle-tests.sh
509+
479510
"upload test results":
480511
- command: attach.xunit_results
481512
params:

.evergreen/generate_evergreen_tasks.js

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -410,11 +410,37 @@ SINGLETON_TASKS.push({
410410
]
411411
});
412412

413+
SINGLETON_TASKS.push({
414+
name: 'run-custom-csfle-tests',
415+
tags: ['run-custom-csfle-tests'],
416+
commands: [
417+
{
418+
func: 'install dependencies',
419+
vars: {
420+
NODE_LTS_NAME: 'erbium',
421+
},
422+
},
423+
{
424+
func: 'bootstrap mongo-orchestration',
425+
vars: {
426+
VERSION: '4.4',
427+
TOPOLOGY: 'server'
428+
}
429+
},
430+
{ func: 'run custom csfle tests' }
431+
]
432+
});
433+
413434
BUILD_VARIANTS.push({
414435
name: 'lint',
415436
display_name: 'lint',
416437
run_on: 'rhel70',
417438
tasks: ['run-checks']
439+
}, {
440+
name: 'ubuntu1804-custom-csfle-tests',
441+
display_name: 'Custom FLE Version Test',
442+
run_on: 'ubuntu1804-test',
443+
tasks: ['run-custom-csfle-tests']
418444
});
419445

420446
// special case for MONGODB-AWS authentication

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

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
#! /usr/bin/env bash
2+
3+
# Initiail checks for running these tests
4+
if [ -z ${AWS_ACCESS_KEY_ID+omitted} ]; then echo "AWS_ACCESS_KEY_ID is unset" && exit 1; fi
5+
if [ -z ${AWS_SECRET_ACCESS_KEY+omitted} ]; then echo "AWS_SECRET_ACCESS_KEY is unset" && exit 1; fi
6+
if [ -z ${CSFLE_KMS_PROVIDERS+omitted} ]; then echo "CSFLE_KMS_PROVIDERS is unset" && exit 1; fi
7+
8+
[ -s "$PROJECT_DIRECTORY/node-artifacts/nvm/nvm.sh" ] && source "$PROJECT_DIRECTORY"/node-artifacts/nvm/nvm.sh
9+
10+
set -o xtrace # Write all commands first to stderr
11+
set -o errexit # Exit the script with error if any of the commands fail
12+
13+
# Environment Variables:
14+
# CSFLE_GIT_REF - set the git reference to checkout for a custom CSFLE version
15+
# CDRIVER_GIT_REF - set the git reference to checkout for a custom CDRIVER version (this is for libbson)
16+
17+
CSFLE_GIT_REF=${CSFLE_GIT_REF:-master}
18+
CDRIVER_GIT_REF=${CDRIVER_GIT_REF:-1.17.4}
19+
20+
rm -rf csfle-deps-tmp
21+
mkdir -p csfle-deps-tmp
22+
pushd csfle-deps-tmp
23+
24+
rm -rf libmongocrypt mongo-c-driver
25+
26+
git clone https://github.com/mongodb/libmongocrypt.git
27+
pushd libmongocrypt
28+
git fetch --tags
29+
git checkout "$CSFLE_GIT_REF" -b csfle-custom
30+
popd # libmongocrypt
31+
32+
git clone https://github.com/mongodb/mongo-c-driver.git
33+
pushd mongo-c-driver
34+
git fetch --tags
35+
git checkout "$CDRIVER_GIT_REF" -b cdriver-custom
36+
popd # mongo-c-driver
37+
38+
pushd libmongocrypt/bindings/node
39+
40+
source ./.evergreen/find_cmake.sh
41+
bash ./etc/build-static.sh
42+
43+
popd # libmongocrypt/bindings/node
44+
popd # csfle-deps-tmp
45+
46+
npm install
47+
48+
cp -r csfle-deps-tmp/libmongocrypt/bindings/node node_modules/mongodb-client-encryption
49+
50+
export MONGODB_UNIFIED_TOPOLOGY=${UNIFIED}
51+
export MONGODB_URI=${MONGODB_URI}
52+
npx mocha test/functional/client_side_encryption

0 commit comments

Comments
 (0)