Skip to content

Commit

Permalink
test: Add evergreen target for custom FLE version tests
Browse files Browse the repository at this point in the history
  • Loading branch information
nbbeeken committed Mar 22, 2021
1 parent ea70d8f commit 9a64369
Show file tree
Hide file tree
Showing 4 changed files with 154 additions and 40 deletions.
83 changes: 44 additions & 39 deletions .evergreen/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -436,6 +436,33 @@ functions:
-p 8100 \
-v \
--fault revoked
run custom csfle tests:
- command: shell.exec
type: test
params:
silent: true
working_dir: src
script: |
cat <<EOT > prepare_client_encryption.sh
export CLIENT_ENCRYPTION=${CLIENT_ENCRYPTION}
export CSFLE_KMS_PROVIDERS='${CSFLE_KMS_PROVIDERS}'
export AWS_ACCESS_KEY_ID="${AWS_ACCESS_KEY_ID}"
export AWS_SECRET_ACCESS_KEY="${AWS_SECRET_ACCESS_KEY}"
EOT
- command: shell.exec
type: test
params:
working_dir: src
timeout_secs: 60
script: |
${PREPARE_SHELL}
# Disable xtrace (just in case it was accidentally set).
set +x
. ./prepare_client_encryption.sh
rm -f ./prepare_client_encryption.sh
UNIFIED=${UNIFIED} MONGODB_URI="${MONGODB_URI}" bash ${PROJECT_DIRECTORY}/.evergreen/run-custom-csfle-tests.sh
upload test results:
- command: attach.xunit_results
params:
Expand Down Expand Up @@ -1387,6 +1414,18 @@ tasks:
vars:
NODE_LTS_NAME: erbium
- func: run checks
- name: run-custom-csfle-tests
tags:
- run-custom-csfle-tests
commands:
- func: install dependencies
vars:
NODE_LTS_NAME: erbium
- func: bootstrap mongo-orchestration
vars:
VERSION: '4.4'
TOPOLOGY: server
- func: run custom csfle tests
buildvariants:
- name: macos-1014-erbium
display_name: macOS 10.14 Node Erbium
Expand Down Expand Up @@ -1468,12 +1507,6 @@ buildvariants:
- test-4.4-ocsp-soft-fail
- test-4.4-ocsp-malicious-invalid-cert-mustStaple-server-does-not-staple
- test-4.4-ocsp-malicious-no-responder-mustStaple-server-does-not-staple
- name: macos-1014-fermium
display_name: macOS 10.14 Node Fermium
run_on: macos-1014
expansions:
NODE_LTS_NAME: fermium
tasks: *ref_0
- name: macos-1014-dubnium
display_name: macOS 10.14 Node Dubnium
run_on: macos-1014
Expand Down Expand Up @@ -1578,12 +1611,6 @@ buildvariants:
- test-4.4-ocsp-soft-fail
- test-4.4-ocsp-malicious-invalid-cert-mustStaple-server-does-not-staple
- test-4.4-ocsp-malicious-no-responder-mustStaple-server-does-not-staple
- name: rhel70-fermium
display_name: RHEL 7.0 Node Fermium
run_on: rhel70-small
expansions:
NODE_LTS_NAME: fermium
tasks: *ref_1
- name: rhel70-dubnium
display_name: RHEL 7.0 Node Dubnium
run_on: rhel70-small
Expand Down Expand Up @@ -1654,12 +1681,6 @@ buildvariants:
- test-auth-kerberos-legacy
- test-auth-kerberos-unified
- test-auth-ldap
- name: ubuntu-14.04-fermium
display_name: Ubuntu 14.04 Node Fermium
run_on: ubuntu1404-test
expansions:
NODE_LTS_NAME: fermium
tasks: *ref_2
- name: ubuntu-14.04-dubnium
display_name: Ubuntu 14.04 Node Dubnium
run_on: ubuntu1404-test
Expand Down Expand Up @@ -1753,13 +1774,6 @@ buildvariants:
- test-4.4-ocsp-soft-fail
- test-4.4-ocsp-malicious-invalid-cert-mustStaple-server-does-not-staple
- test-4.4-ocsp-malicious-no-responder-mustStaple-server-does-not-staple
- name: ubuntu-18.04-fermium
display_name: Ubuntu 18.04 Node Fermium
run_on: ubuntu1804-test
expansions:
NODE_LTS_NAME: fermium
CLIENT_ENCRYPTION: true
tasks: *ref_3
- name: ubuntu-18.04-dubnium
display_name: Ubuntu 18.04 Node Dubnium
run_on: ubuntu1804-test
Expand Down Expand Up @@ -1852,13 +1866,6 @@ buildvariants:
NODE_LTS_NAME: argon
MSVS_VERSION: 2013
tasks: *ref_4
- name: windows-64-vs2015-fermium
display_name: Windows (VS2015) Node Fermium
run_on: windows-64-vs2015-large
expansions:
NODE_LTS_NAME: fermium
MSVS_VERSION: 2015
tasks: *ref_4
- name: windows-64-vs2015-erbium
display_name: Windows (VS2015) Node Erbium
run_on: windows-64-vs2015-large
Expand Down Expand Up @@ -1894,13 +1901,6 @@ buildvariants:
NODE_LTS_NAME: argon
MSVS_VERSION: 2015
tasks: *ref_4
- name: windows-64-vs2017-fermium
display_name: Windows (VS2017) Node Fermium
run_on: windows-64-vs2017-large
expansions:
NODE_LTS_NAME: fermium
MSVS_VERSION: 2017
tasks: *ref_4
- name: windows-64-vs2017-erbium
display_name: Windows (VS2017) Node Erbium
run_on: windows-64-vs2017-large
Expand Down Expand Up @@ -1941,6 +1941,11 @@ buildvariants:
run_on: rhel70
tasks:
- run-checks
- name: ubuntu1804-custom-csfle-tests
display_name: Custom FLE Test
run_on: ubuntu1804-test
tasks:
- run-custom-csfle-tests
- name: ubuntu1804-test-mongodb-aws
display_name: MONGODB-AWS Auth test
run_on: ubuntu1804-test
Expand Down
33 changes: 32 additions & 1 deletion .evergreen/config.yml.in
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ functions:
bash ${PROJECT_DIRECTORY}/.evergreen/install-dependencies.sh
- command: expansions.update
params:
file: src/deps-expansion.yml
file: src/deps-expansion.yml

"run atlas tests":
- command: shell.exec
Expand Down Expand Up @@ -476,6 +476,37 @@ functions:
-v \
--fault revoked

"run custom csfle tests":
- command: shell.exec
type: test
params:
silent: true
working_dir: "src"
script: |
${PREPARE_SHELL}
cat <<EOT > prepare_client_encryption.sh
export CLIENT_ENCRYPTION=${CLIENT_ENCRYPTION}
export CSFLE_KMS_PROVIDERS='${CSFLE_KMS_PROVIDERS}'
export AWS_ACCESS_KEY_ID="${AWS_ACCESS_KEY_ID}"
export AWS_SECRET_ACCESS_KEY="${AWS_SECRET_ACCESS_KEY}"
export CSFLE_GIT_REF="${CSFLE_GIT_REF}"
export CDRIVER_GIT_REF="${CDRIVER_GIT_REF}"
EOT
- command: shell.exec
type: test
params:
working_dir: "src"
timeout_secs: 60
script: |
${PREPARE_SHELL}

# Disable xtrace (just in case it was accidentally set).
set +x
. ./prepare_client_encryption.sh
rm -f ./prepare_client_encryption.sh

UNIFIED=${UNIFIED} MONGODB_URI="${MONGODB_URI}" bash ${PROJECT_DIRECTORY}/.evergreen/run-custom-csfle-tests.sh

"upload test results":
- command: attach.xunit_results
params:
Expand Down
26 changes: 26 additions & 0 deletions .evergreen/generate_evergreen_tasks.js
Original file line number Diff line number Diff line change
Expand Up @@ -410,11 +410,37 @@ SINGLETON_TASKS.push({
]
});

SINGLETON_TASKS.push({
name: 'run-custom-csfle-tests',
tags: ['run-custom-csfle-tests'],
commands: [
{
func: 'install dependencies',
vars: {
NODE_LTS_NAME: 'erbium',
},
},
{
func: 'bootstrap mongo-orchestration',
vars: {
VERSION: '4.4',
TOPOLOGY: 'server'
}
},
{ func: 'run custom csfle tests' }
]
});

BUILD_VARIANTS.push({
name: 'lint',
display_name: 'lint',
run_on: 'rhel70',
tasks: ['run-checks']
}, {
name: 'ubuntu1804-custom-csfle-tests',
display_name: 'Custom FLE Version Test',
run_on: 'ubuntu1804-test',
tasks: ['run-custom-csfle-tests']
});

// special case for MONGODB-AWS authentication
Expand Down
52 changes: 52 additions & 0 deletions .evergreen/run-custom-csfle-tests.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
#! /usr/bin/env bash

# Initiail checks for running these tests
if [ -z ${AWS_ACCESS_KEY_ID+omitted} ]; then echo "AWS_ACCESS_KEY_ID is unset" && exit 1; fi
if [ -z ${AWS_SECRET_ACCESS_KEY+omitted} ]; then echo "AWS_SECRET_ACCESS_KEY is unset" && exit 1; fi
if [ -z ${CSFLE_KMS_PROVIDERS+omitted} ]; then echo "CSFLE_KMS_PROVIDERS is unset" && exit 1; fi

[ -s "$PROJECT_DIRECTORY/node-artifacts/nvm/nvm.sh" ] && source "$PROJECT_DIRECTORY"/node-artifacts/nvm/nvm.sh

set -o xtrace # Write all commands first to stderr
set -o errexit # Exit the script with error if any of the commands fail

# Environment Variables:
# CSFLE_GIT_REF - set the git reference to checkout for a custom CSFLE version
# CDRIVER_GIT_REF - set the git reference to checkout for a custom CDRIVER version (this is for libbson)

CSFLE_GIT_REF=${CSFLE_GIT_REF:-master}
CDRIVER_GIT_REF=${CDRIVER_GIT_REF:-1.17.4}

rm -rf csfle-deps-tmp
mkdir -p csfle-deps-tmp
pushd csfle-deps-tmp

rm -rf libmongocrypt mongo-c-driver

git clone https://github.com/mongodb/libmongocrypt.git
pushd libmongocrypt
git fetch --tags
git checkout "$CSFLE_GIT_REF" -b csfle-custom
popd # libmongocrypt

git clone https://github.com/mongodb/mongo-c-driver.git
pushd mongo-c-driver
git fetch --tags
git checkout "$CDRIVER_GIT_REF" -b cdriver-custom
popd # mongo-c-driver

pushd libmongocrypt/bindings/node

source ./.evergreen/find_cmake.sh
bash ./etc/build-static.sh

popd # libmongocrypt/bindings/node
popd # csfle-deps-tmp

npm install

cp -r csfle-deps-tmp/libmongocrypt/bindings/node node_modules/mongodb-client-encryption

export MONGODB_UNIFIED_TOPOLOGY=${UNIFIED}
export MONGODB_URI=${MONGODB_URI}
npx mocha test/functional/client_side_encryption

0 comments on commit 9a64369

Please sign in to comment.