Skip to content

Commit

Permalink
chore(NODE-3719): spec compliance review wrap up (#3145)
Browse files Browse the repository at this point in the history
  • Loading branch information
dariakp committed Feb 16, 2022
1 parent b192493 commit aa069f1
Show file tree
Hide file tree
Showing 13 changed files with 967 additions and 847 deletions.
10 changes: 5 additions & 5 deletions .evergreen/config.yml
Expand Up @@ -143,7 +143,7 @@ functions:
fi
MONGODB_URI="${MONGODB_URI}" \
AUTH=${AUTH} SSL=${SSL} UNIFIED=${UNIFIED} \
AUTH=${AUTH} SSL=${SSL} TEST_CSFLE=true \
MONGODB_API_VERSION="${MONGODB_API_VERSION}" \
NODE_VERSION=${NODE_VERSION} SKIP_DEPS=${SKIP_DEPS|1} NO_EXIT=${NO_EXIT|1} \
bash ${PROJECT_DIRECTORY}/.evergreen/run-tests.sh
Expand Down Expand Up @@ -204,7 +204,6 @@ functions:
MONGODB_URI="${MONGODB_URI}" \
AUTH=${AUTH} \
SSL=${SSL} \
UNIFIED=${UNIFIED} \
MONGODB_API_VERSION="${MONGODB_API_VERSION}" \
NODE_VERSION=${NODE_VERSION} \
SINGLE_MONGOS_LB_URI="${SINGLE_MONGOS_LB_URI}" \
Expand Down Expand Up @@ -595,7 +594,6 @@ functions:
script: |
${PREPARE_SHELL}
UNIFIED=${UNIFIED} \
CA_FILE="$DRIVERS_TOOLS/.evergreen/ocsp/rsa/ca.pem" \
OCSP_TLS_SHOULD_SUCCEED="${OCSP_TLS_SHOULD_SUCCEED}" \
bash ${PROJECT_DIRECTORY}/.evergreen/run-ocsp-tests.sh
Expand Down Expand Up @@ -2353,9 +2351,11 @@ buildvariants:
NODE_LTS_NAME: erbium
tasks:
- serverless_task_group
- name: no-auth-tests
- name: ubuntu1804-no-auth-tests
display_name: No Auth Tests
run_on: ubuntu1804-test
run_on: ubuntu1804-large
expansions:
CLIENT_ENCRYPTION: true
tasks:
- test-latest-server-noauth
- test-latest-replica_set-noauth
Expand Down
4 changes: 1 addition & 3 deletions .evergreen/config.yml.in
Expand Up @@ -163,7 +163,7 @@ functions:
fi

MONGODB_URI="${MONGODB_URI}" \
AUTH=${AUTH} SSL=${SSL} UNIFIED=${UNIFIED} \
AUTH=${AUTH} SSL=${SSL} TEST_CSFLE=true \
MONGODB_API_VERSION="${MONGODB_API_VERSION}" \
NODE_VERSION=${NODE_VERSION} SKIP_DEPS=${SKIP_DEPS|1} NO_EXIT=${NO_EXIT|1} \
bash ${PROJECT_DIRECTORY}/.evergreen/run-tests.sh
Expand Down Expand Up @@ -228,7 +228,6 @@ functions:
MONGODB_URI="${MONGODB_URI}" \
AUTH=${AUTH} \
SSL=${SSL} \
UNIFIED=${UNIFIED} \
MONGODB_API_VERSION="${MONGODB_API_VERSION}" \
NODE_VERSION=${NODE_VERSION} \
SINGLE_MONGOS_LB_URI="${SINGLE_MONGOS_LB_URI}" \
Expand Down Expand Up @@ -629,7 +628,6 @@ functions:
script: |
${PREPARE_SHELL}

UNIFIED=${UNIFIED} \
CA_FILE="$DRIVERS_TOOLS/.evergreen/ocsp/rsa/ca.pem" \
OCSP_TLS_SHOULD_SUCCEED="${OCSP_TLS_SHOULD_SUCCEED}" \
bash ${PROJECT_DIRECTORY}/.evergreen/run-ocsp-tests.sh
Expand Down
31 changes: 19 additions & 12 deletions .evergreen/generate_evergreen_tasks.js
Expand Up @@ -72,16 +72,18 @@ function generateVersionTopologyMatrix() {
function* _generate() {
for (const mongoVersion of MONGODB_VERSIONS) {
for (const topology of TOPOLOGIES) {
yield { mongoVersion, topology}
yield { mongoVersion, topology };
}
}
}

return Array.from(_generate());
}

const BASE_TASKS = generateVersionTopologyMatrix().map(makeTask)
const AUTH_DISABLED_TASKS = generateVersionTopologyMatrix().map((test) => makeTask({ ...test, auth: 'noauth', tags: ['noauth'] }))
const BASE_TASKS = generateVersionTopologyMatrix().map(makeTask);
const AUTH_DISABLED_TASKS = generateVersionTopologyMatrix().map(test =>
makeTask({ ...test, auth: 'noauth', tags: ['noauth'] })
);

BASE_TASKS.push({
name: `test-latest-server-v1-api`,
Expand Down Expand Up @@ -323,7 +325,7 @@ TLS_VERSIONS.forEach(VERSION => {
vars: {
VERSION,
SSL: 'ssl',
TOPOLOGY: 'server',
TOPOLOGY: 'server'
// TODO: NODE-3891 - fix tests broken when AUTH enabled
// AUTH: 'auth'
}
Expand Down Expand Up @@ -702,10 +704,8 @@ const coverageTask = {
func: 'download and merge coverage'
}
],
depends_on: [
{ name: '*', variant: '*', status: '*', patch_optional: true }
]
}
depends_on: [{ name: '*', variant: '*', status: '*', patch_optional: true }]
};

SINGLETON_TASKS.push(...oneOffFuncAsTasks);

Expand All @@ -728,14 +728,21 @@ BUILD_VARIANTS.push({
});

BUILD_VARIANTS.push({
name: 'no-auth-tests',
name: 'ubuntu1804-no-auth-tests',
display_name: 'No Auth Tests',
run_on: 'ubuntu1804-test',
run_on: DEFAULT_OS,
expansions: {
CLIENT_ENCRYPTION: true
},
tasks: AUTH_DISABLED_TASKS.map(({ name }) => name)
})
});

const fileData = yaml.load(fs.readFileSync(`${__dirname}/config.yml.in`, 'utf8'));
fileData.tasks = (fileData.tasks || []).concat(BASE_TASKS).concat(TASKS).concat(SINGLETON_TASKS).concat(AUTH_DISABLED_TASKS);
fileData.tasks = (fileData.tasks || [])
.concat(BASE_TASKS)
.concat(TASKS)
.concat(SINGLETON_TASKS)
.concat(AUTH_DISABLED_TASKS);
fileData.buildvariants = (fileData.buildvariants || []).concat(BUILD_VARIANTS);

fs.writeFileSync(`${__dirname}/config.yml`, yaml.dump(fileData, { lineWidth: 120 }), 'utf8');
3 changes: 2 additions & 1 deletion .evergreen/run-custom-csfle-tests.sh
Expand Up @@ -19,7 +19,7 @@ set -o errexit # Exit the script with error if any of the commands fail
# Get access to the AWS temporary credentials:
echo "adding temporary AWS credentials to environment"
# CSFLE_AWS_TEMP_ACCESS_KEY_ID, CSFLE_AWS_TEMP_SECRET_ACCESS_KEY, CSFLE_AWS_TEMP_SESSION_TOKEN
. $DRIVERS_TOOLS/.evergreen/csfle/set-temp-creds.sh
. "$DRIVERS_TOOLS"/.evergreen/csfle/set-temp-creds.sh

ABS_PATH_TO_PATCH=$(pwd)

Expand Down Expand Up @@ -65,6 +65,7 @@ cp -R ../csfle-deps-tmp/libmongocrypt/bindings/node node_modules/mongodb-client-
export MONGODB_URI=${MONGODB_URI}
export KMIP_TLS_CA_FILE="${DRIVERS_TOOLS}/.evergreen/x509gen/ca.pem"
export KMIP_TLS_CERT_FILE="${DRIVERS_TOOLS}/.evergreen/x509gen/client.pem"
export TEST_CSFLE=true
set +o errexit # We want to run both test suites even if the first fails
npm run check:csfle
DRIVER_CSFLE_TEST_RESULT=$?
Expand Down
7 changes: 2 additions & 5 deletions .evergreen/run-ocsp-tests.sh
Expand Up @@ -2,8 +2,6 @@
set -o xtrace
set -o errexit

UNIFIED=${UNIFIED:-}

# load node.js environment
source "${PROJECT_DIRECTORY}/.evergreen/init-nvm.sh"

Expand All @@ -14,7 +12,6 @@ source "${PROJECT_DIRECTORY}/.evergreen/init-nvm.sh"
# PYTHON=python

# NOTE: `--opts {}` is used below to revert mocha to normal behavior (without mongodb specific plugins)
MONGODB_UNIFIED_TOPOLOGY=${UNIFIED} \
OCSP_TLS_SHOULD_SUCCEED=${OCSP_TLS_SHOULD_SUCCEED} \
CA_FILE=${CA_FILE} \
export OCSP_TLS_SHOULD_SUCCEED=${OCSP_TLS_SHOULD_SUCCEED}
export CA_FILE=${CA_FILE}
npm run check:ocsp
15 changes: 11 additions & 4 deletions .evergreen/run-tests.sh
Expand Up @@ -5,15 +5,14 @@ set -o errexit # Exit the script with error if any of the commands fail
# Supported/used environment variables:
# AUTH Set to enable authentication. Defaults to "noauth"
# SSL Set to enable SSL. Defaults to "nossl"
# UNIFIED Set to enable the Unified SDAM topology for the node driver
# MONGODB_URI Set the suggested connection MONGODB_URI (including credentials and topology info)
# MARCH Machine Architecture. Defaults to lowercase uname -m
# TEST_NPM_SCRIPT Script to npm run. Defaults to "integration-coverage"
# SKIP_DEPS Skip installing dependencies
# NO_EXIT Don't exit early from tests that leak resources
# TEST_CSFLE Set to enforce running csfle tests

AUTH=${AUTH:-noauth}
UNIFIED=${UNIFIED:-}
MONGODB_URI=${MONGODB_URI:-}
TEST_NPM_SCRIPT=${TEST_NPM_SCRIPT:-check:integration-coverage}
if [[ -z "${NO_EXIT}" ]]; then
Expand Down Expand Up @@ -45,9 +44,17 @@ else
# Get access to the AWS temporary credentials:
echo "adding temporary AWS credentials to environment"
# CSFLE_AWS_TEMP_ACCESS_KEY_ID, CSFLE_AWS_TEMP_SECRET_ACCESS_KEY, CSFLE_AWS_TEMP_SESSION_TOKEN
. $DRIVERS_TOOLS/.evergreen/csfle/set-temp-creds.sh
source "$DRIVERS_TOOLS"/.evergreen/csfle/set-temp-creds.sh
fi

npm install mongodb-client-encryption@">=2.0.0-beta.4"

AUTH=$AUTH SINGLE_MONGOS_LB_URI=${SINGLE_MONGOS_LB_URI} MULTI_MONGOS_LB_URI=${MULTI_MONGOS_LB_URI} MONGODB_API_VERSION=${MONGODB_API_VERSION} MONGODB_UNIFIED_TOPOLOGY=${UNIFIED} MONGODB_URI=${MONGODB_URI} LOAD_BALANCER=${LOAD_BALANCER} npm run ${TEST_NPM_SCRIPT}
export AUTH=$AUTH
export SINGLE_MONGOS_LB_URI=${SINGLE_MONGOS_LB_URI}
export MULTI_MONGOS_LB_URI=${MULTI_MONGOS_LB_URI}
export MONGODB_API_VERSION=${MONGODB_API_VERSION}
export MONGODB_URI=${MONGODB_URI}
export LOAD_BALANCER=${LOAD_BALANCER}
export TEST_CSFLE=${TEST_CSFLE}
# Do not add quotes, due to the way NO_EXIT is handled
npm run ${TEST_NPM_SCRIPT}
Expand Up @@ -8,7 +8,7 @@ const BSON = require('bson');
const { EJSON } = require('bson');
const { expect } = require('chai');

describe('Client Side Encryption Corpus', function () {
describe('Client Side Encryption Prose Corpus Test', function () {
const metadata = {
requires: {
mongodb: '>=4.2.0',
Expand Down

0 comments on commit aa069f1

Please sign in to comment.