Skip to content

Commit 082fdcb

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

File tree

4 files changed

+161
-40
lines changed

4 files changed

+161
-40
lines changed

.evergreen/config.yml

Lines changed: 49 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,8 @@ functions:
5151
export MONGODB_BINARIES="$MONGODB_BINARIES"
5252
export UPLOAD_BUCKET="$UPLOAD_BUCKET"
5353
export PROJECT_DIRECTORY="$PROJECT_DIRECTORY"
54+
export CSFLE_GIT_REF="$CSFLE_GIT_REF"
55+
export CDRIVER_GIT_REF="$CDRIVER_GIT_REF"
5456
5557
export TMPDIR="$MONGO_ORCHESTRATION_HOME/db"
5658
export PATH="$MONGODB_BINARIES:$PATH"
@@ -436,6 +438,36 @@ functions:
436438
-p 8100 \
437439
-v \
438440
--fault revoked
441+
run custom csfle tests:
442+
- command: shell.exec
443+
type: test
444+
params:
445+
silent: true
446+
working_dir: src
447+
script: |
448+
${PREPARE_SHELL}
449+
cat <<EOT > prepare_client_encryption.sh
450+
export CLIENT_ENCRYPTION=${CLIENT_ENCRYPTION}
451+
export CSFLE_KMS_PROVIDERS='${CSFLE_KMS_PROVIDERS}'
452+
export AWS_ACCESS_KEY_ID="${AWS_ACCESS_KEY_ID}"
453+
export AWS_SECRET_ACCESS_KEY="${AWS_SECRET_ACCESS_KEY}"
454+
export CSFLE_GIT_REF="${CSFLE_GIT_REF}"
455+
export CDRIVER_GIT_REF="${CDRIVER_GIT_REF}"
456+
EOT
457+
- command: shell.exec
458+
type: test
459+
params:
460+
working_dir: src
461+
timeout_secs: 60
462+
script: |
463+
${PREPARE_SHELL}
464+
465+
# Disable xtrace (just in case it was accidentally set).
466+
set +x
467+
. ./prepare_client_encryption.sh
468+
rm -f ./prepare_client_encryption.sh
469+
470+
UNIFIED=${UNIFIED} MONGODB_URI="${MONGODB_URI}" bash ${PROJECT_DIRECTORY}/.evergreen/run-custom-csfle-tests.sh
439471
upload test results:
440472
- command: attach.xunit_results
441473
params:
@@ -1387,6 +1419,18 @@ tasks:
13871419
vars:
13881420
NODE_LTS_NAME: erbium
13891421
- func: run checks
1422+
- name: run-custom-csfle-tests
1423+
tags:
1424+
- run-custom-csfle-tests
1425+
commands:
1426+
- func: install dependencies
1427+
vars:
1428+
NODE_LTS_NAME: erbium
1429+
- func: bootstrap mongo-orchestration
1430+
vars:
1431+
VERSION: '4.4'
1432+
TOPOLOGY: server
1433+
- func: run custom csfle tests
13901434
buildvariants:
13911435
- name: macos-1014-erbium
13921436
display_name: macOS 10.14 Node Erbium
@@ -1468,12 +1512,6 @@ buildvariants:
14681512
- test-4.4-ocsp-soft-fail
14691513
- test-4.4-ocsp-malicious-invalid-cert-mustStaple-server-does-not-staple
14701514
- 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
14771515
- name: macos-1014-dubnium
14781516
display_name: macOS 10.14 Node Dubnium
14791517
run_on: macos-1014
@@ -1578,12 +1616,6 @@ buildvariants:
15781616
- test-4.4-ocsp-soft-fail
15791617
- test-4.4-ocsp-malicious-invalid-cert-mustStaple-server-does-not-staple
15801618
- 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
15871619
- name: rhel70-dubnium
15881620
display_name: RHEL 7.0 Node Dubnium
15891621
run_on: rhel70-small
@@ -1654,12 +1686,6 @@ buildvariants:
16541686
- test-auth-kerberos-legacy
16551687
- test-auth-kerberos-unified
16561688
- 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
16631689
- name: ubuntu-14.04-dubnium
16641690
display_name: Ubuntu 14.04 Node Dubnium
16651691
run_on: ubuntu1404-test
@@ -1753,13 +1779,6 @@ buildvariants:
17531779
- test-4.4-ocsp-soft-fail
17541780
- test-4.4-ocsp-malicious-invalid-cert-mustStaple-server-does-not-staple
17551781
- 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
17631782
- name: ubuntu-18.04-dubnium
17641783
display_name: Ubuntu 18.04 Node Dubnium
17651784
run_on: ubuntu1804-test
@@ -1852,13 +1871,6 @@ buildvariants:
18521871
NODE_LTS_NAME: argon
18531872
MSVS_VERSION: 2013
18541873
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
18621874
- name: windows-64-vs2015-erbium
18631875
display_name: Windows (VS2015) Node Erbium
18641876
run_on: windows-64-vs2015-large
@@ -1894,13 +1906,6 @@ buildvariants:
18941906
NODE_LTS_NAME: argon
18951907
MSVS_VERSION: 2015
18961908
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
19041909
- name: windows-64-vs2017-erbium
19051910
display_name: Windows (VS2017) Node Erbium
19061911
run_on: windows-64-vs2017-large
@@ -1941,6 +1946,11 @@ buildvariants:
19411946
run_on: rhel70
19421947
tasks:
19431948
- run-checks
1949+
- name: ubuntu1804-custom-csfle-tests
1950+
display_name: Custom FLE Version Test
1951+
run_on: ubuntu1804-test
1952+
tasks:
1953+
- run-custom-csfle-tests
19441954
- name: ubuntu1804-test-mongodb-aws
19451955
display_name: MONGODB-AWS Auth test
19461956
run_on: ubuntu1804-test

.evergreen/config.yml.in

Lines changed: 34 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,8 @@ functions:
6767
export MONGODB_BINARIES="$MONGODB_BINARIES"
6868
export UPLOAD_BUCKET="$UPLOAD_BUCKET"
6969
export PROJECT_DIRECTORY="$PROJECT_DIRECTORY"
70+
export CSFLE_GIT_REF="$CSFLE_GIT_REF"
71+
export CDRIVER_GIT_REF="$CDRIVER_GIT_REF"
7072

7173
export TMPDIR="$MONGO_ORCHESTRATION_HOME/db"
7274
export PATH="$MONGODB_BINARIES:$PATH"
@@ -195,7 +197,7 @@ functions:
195197
bash ${PROJECT_DIRECTORY}/.evergreen/install-dependencies.sh
196198
- command: expansions.update
197199
params:
198-
file: src/deps-expansion.yml
200+
file: src/deps-expansion.yml
199201

200202
"run atlas tests":
201203
- command: shell.exec
@@ -476,6 +478,37 @@ functions:
476478
-v \
477479
--fault revoked
478480

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