Skip to content

Commit 45fd876

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

File tree

4 files changed

+157
-40
lines changed

4 files changed

+157
-40
lines changed

.evergreen/config.yml

Lines changed: 47 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -436,6 +436,36 @@ 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+
${PREPARE_SHELL}
447+
cat <<EOT > prepare_client_encryption.sh
448+
export CLIENT_ENCRYPTION=${CLIENT_ENCRYPTION}
449+
export CSFLE_KMS_PROVIDERS='${CSFLE_KMS_PROVIDERS}'
450+
export AWS_ACCESS_KEY_ID="${AWS_ACCESS_KEY_ID}"
451+
export AWS_SECRET_ACCESS_KEY="${AWS_SECRET_ACCESS_KEY}"
452+
export CSFLE_GIT_REF="${CSFLE_GIT_REF}"
453+
export CDRIVER_GIT_REF="${CDRIVER_GIT_REF}"
454+
EOT
455+
- command: shell.exec
456+
type: test
457+
params:
458+
working_dir: src
459+
timeout_secs: 60
460+
script: |
461+
${PREPARE_SHELL}
462+
463+
# Disable xtrace (just in case it was accidentally set).
464+
set +x
465+
. ./prepare_client_encryption.sh
466+
rm -f ./prepare_client_encryption.sh
467+
468+
UNIFIED=${UNIFIED} MONGODB_URI="${MONGODB_URI}" bash ${PROJECT_DIRECTORY}/.evergreen/run-custom-csfle-tests.sh
439469
upload test results:
440470
- command: attach.xunit_results
441471
params:
@@ -1387,6 +1417,18 @@ tasks:
13871417
vars:
13881418
NODE_LTS_NAME: erbium
13891419
- func: run checks
1420+
- name: run-custom-csfle-tests
1421+
tags:
1422+
- run-custom-csfle-tests
1423+
commands:
1424+
- func: install dependencies
1425+
vars:
1426+
NODE_LTS_NAME: erbium
1427+
- func: bootstrap mongo-orchestration
1428+
vars:
1429+
VERSION: '4.4'
1430+
TOPOLOGY: server
1431+
- func: run custom csfle tests
13901432
buildvariants:
13911433
- name: macos-1014-erbium
13921434
display_name: macOS 10.14 Node Erbium
@@ -1468,12 +1510,6 @@ buildvariants:
14681510
- test-4.4-ocsp-soft-fail
14691511
- test-4.4-ocsp-malicious-invalid-cert-mustStaple-server-does-not-staple
14701512
- 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
14771513
- name: macos-1014-dubnium
14781514
display_name: macOS 10.14 Node Dubnium
14791515
run_on: macos-1014
@@ -1578,12 +1614,6 @@ buildvariants:
15781614
- test-4.4-ocsp-soft-fail
15791615
- test-4.4-ocsp-malicious-invalid-cert-mustStaple-server-does-not-staple
15801616
- 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
15871617
- name: rhel70-dubnium
15881618
display_name: RHEL 7.0 Node Dubnium
15891619
run_on: rhel70-small
@@ -1654,12 +1684,6 @@ buildvariants:
16541684
- test-auth-kerberos-legacy
16551685
- test-auth-kerberos-unified
16561686
- 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
16631687
- name: ubuntu-14.04-dubnium
16641688
display_name: Ubuntu 14.04 Node Dubnium
16651689
run_on: ubuntu1404-test
@@ -1753,13 +1777,6 @@ buildvariants:
17531777
- test-4.4-ocsp-soft-fail
17541778
- test-4.4-ocsp-malicious-invalid-cert-mustStaple-server-does-not-staple
17551779
- 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
17631780
- name: ubuntu-18.04-dubnium
17641781
display_name: Ubuntu 18.04 Node Dubnium
17651782
run_on: ubuntu1804-test
@@ -1852,13 +1869,6 @@ buildvariants:
18521869
NODE_LTS_NAME: argon
18531870
MSVS_VERSION: 2013
18541871
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
18621872
- name: windows-64-vs2015-erbium
18631873
display_name: Windows (VS2015) Node Erbium
18641874
run_on: windows-64-vs2015-large
@@ -1894,13 +1904,6 @@ buildvariants:
18941904
NODE_LTS_NAME: argon
18951905
MSVS_VERSION: 2015
18961906
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
19041907
- name: windows-64-vs2017-erbium
19051908
display_name: Windows (VS2017) Node Erbium
19061909
run_on: windows-64-vs2017-large
@@ -1941,6 +1944,11 @@ buildvariants:
19411944
run_on: rhel70
19421945
tasks:
19431946
- run-checks
1947+
- name: ubuntu1804-custom-csfle-tests
1948+
display_name: Custom FLE Version Test
1949+
run_on: ubuntu1804-test
1950+
tasks:
1951+
- run-custom-csfle-tests
19441952
- name: ubuntu1804-test-mongodb-aws
19451953
display_name: MONGODB-AWS Auth test
19461954
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)