diff --git a/.evergreen/config.yml b/.evergreen/config.yml index 57b4cccc48d..a67e252bfb9 100644 --- a/.evergreen/config.yml +++ b/.evergreen/config.yml @@ -11,7 +11,7 @@ functions: - command: git.get_project params: directory: src - - command: git.apply_patch + shallow_clone: true - command: shell.exec params: working_dir: src @@ -24,11 +24,20 @@ functions: fi export DRIVERS_TOOLS="$(pwd)/../drivers-tools" + export PROJECT_DIRECTORY="$(pwd)" export MONGO_ORCHESTRATION_HOME="$DRIVERS_TOOLS/.evergreen/orchestration" export MONGODB_BINARIES="$DRIVERS_TOOLS/mongodb/bin" export UPLOAD_BUCKET="${project}" + # fix paths on windows + if [ "Windows_NT" = "$OS" ]; then + export DRIVERS_TOOLS=$(cygpath -m -a $DRIVERS_TOOLS) + export MONGO_ORCHESTRATION_HOME=$(cygpath -m -a $MONGO_ORCHESTRATION_HOME) + export MONGODB_BINARIES=$(cygpath -m -a $MONGODB_BINARIES) + export PROJECT_DIRECTORY=$(cygpath -m -a $PROJECT_DIRECTORY) + fi + cat < expansion.yml CURRENT_VERSION: "$CURRENT_VERSION" DRIVERS_TOOLS: "$DRIVERS_TOOLS" @@ -60,14 +69,7 @@ functions: script: > ${PREPARE_SHELL} - rm -rf $DRIVERS_TOOLS - - if [ "${project}" = "drivers-tools" ]; then - # If this was a patch build, doing a fresh clone would not actually test the patch - cp -R ${PROJECT_DIRECTORY}/ $DRIVERS_TOOLS - else - git clone git://github.com/mongodb-labs/drivers-evergreen-tools.git $DRIVERS_TOOLS - fi + git clone --depth 1 git://github.com/mongodb-labs/drivers-evergreen-tools.git $DRIVERS_TOOLS echo "{ \"releases\": { \"default\": \"$MONGODB_BINARIES\" }}" > $MONGO_ORCHESTRATION_HOME/orchestration.config @@ -113,6 +115,7 @@ functions: type: test params: working_dir: src + timeout_secs: 60 script: | ${PREPARE_SHELL} @@ -124,7 +127,8 @@ functions: fi AUTH=${AUTH} SSL=${SSL} UNIFIED=${UNIFIED} MONGODB_URI="${MONGODB_URI}" \ - bash ${PROJECT_DIRECTORY}/.evergreen/run-tests.sh + NODE_VERSION=${NODE_VERSION} SKIP_DEPS=1 NO_EXIT=1 \ + bash ${PROJECT_DIRECTORY}/.evergreen/run-tests.sh run checks: - command: shell.exec type: test @@ -136,20 +140,35 @@ functions: cleanup: - command: shell.exec params: + silent: true script: | ${PREPARE_SHELL} rm -rf $DRIVERS_TOOLS || true fix absolute paths: - command: shell.exec params: + silent: true script: | ${PREPARE_SHELL} for filename in $(find ${DRIVERS_TOOLS} -name \*.json); do perl -p -i -e "s|ABSOLUTE_PATH_REPLACEMENT_TOKEN|${DRIVERS_TOOLS}|g" $filename done + windows fix: + - command: shell.exec + params: + silent: true + script: | + ${PREPARE_SHELL} + # for i in $(find ${DRIVERS_TOOLS}/.evergreen ${PROJECT_DIRECTORY}/.evergreen -name \*.sh); do + # cat $i | tr -d '\r' > $i.new + # mv $i.new $i + # done + # Copy client certificate because symlinks do not work on Windows. + cp ${DRIVERS_TOOLS}/.evergreen/x509gen/client.pem ${MONGO_ORCHESTRATION_HOME}/lib/client.pem make files executable: - command: shell.exec params: + silent: true script: | ${PREPARE_SHELL} for i in $(find ${DRIVERS_TOOLS}/.evergreen ${PROJECT_DIRECTORY}/.evergreen -name \*.sh); do @@ -162,7 +181,11 @@ functions: working_dir: src script: | ${PREPARE_SHELL} - NODE_LTS_NAME=${NODE_LTS_NAME} bash ${PROJECT_DIRECTORY}/.evergreen/install-dependencies.sh + NODE_LTS_NAME=${NODE_LTS_NAME} MSVS_VERSION=${MSVS_VERSION} \ + bash ${PROJECT_DIRECTORY}/.evergreen/install-dependencies.sh + - command: expansions.update + params: + file: src/deps-expansion.yml run atlas tests: - command: shell.exec type: test @@ -439,11 +462,14 @@ functions: pre: - func: fetch source - func: prepare resources + - func: windows fix - func: fix absolute paths - func: make files executable post: - func: upload test results - func: cleanup +ignore: + - '*.md' tasks: - name: test-latest-server tags: @@ -1186,7 +1212,7 @@ buildvariants: tasks: *ref_0 - name: ubuntu-14.04-dubnium display_name: Ubuntu 14.04 Node Dubnium - run_on: ubuntu1404-test + run_on: ubuntu1404-large expansions: NODE_LTS_NAME: dubnium tasks: &ref_1 @@ -1214,13 +1240,13 @@ buildvariants: - test-auth-ldap - name: ubuntu-14.04-erbium display_name: Ubuntu 14.04 Node Erbium - run_on: ubuntu1404-test + run_on: ubuntu1404-large expansions: NODE_LTS_NAME: erbium tasks: *ref_1 - name: ubuntu-18.04-dubnium display_name: Ubuntu 18.04 Node Dubnium - run_on: ubuntu1804-test + run_on: ubuntu1804-large expansions: NODE_LTS_NAME: dubnium CLIENT_ENCRYPTION: true @@ -1274,11 +1300,60 @@ buildvariants: - test-4.4-ocsp-malicious-no-responder-mustStaple-server-does-not-staple - name: ubuntu-18.04-erbium display_name: Ubuntu 18.04 Node Erbium - run_on: ubuntu1804-test + run_on: ubuntu1804-large expansions: NODE_LTS_NAME: erbium CLIENT_ENCRYPTION: true tasks: *ref_2 + - name: windows-64-vs2015-dubnium + display_name: Windows (VS2015) Node Dubnium + run_on: windows-64-vs2015-large + expansions: + NODE_LTS_NAME: dubnium + MSVS_VERSION: 2015 + tasks: &ref_3 + - test-4.2-server + - test-4.2-replica_set + - test-4.2-sharded_cluster + - test-4.0-server + - test-4.0-replica_set + - test-4.0-sharded_cluster + - test-3.6-server + - test-3.6-replica_set + - test-3.6-sharded_cluster + - test-3.4-server + - test-3.4-replica_set + - test-3.4-sharded_cluster + - test-3.2-server + - test-3.2-replica_set + - test-3.2-sharded_cluster + - test-3.0-server + - test-3.0-replica_set + - test-3.0-sharded_cluster + - test-2.6-server + - test-2.6-replica_set + - test-2.6-sharded_cluster + - name: windows-64-vs2015-erbium + display_name: Windows (VS2015) Node Erbium + run_on: windows-64-vs2015-large + expansions: + NODE_LTS_NAME: erbium + MSVS_VERSION: 2015 + tasks: *ref_3 + - name: windows-64-vs2017-dubnium + display_name: Windows (VS2017) Node Dubnium + run_on: windows-64-vs2017-large + expansions: + NODE_LTS_NAME: dubnium + MSVS_VERSION: 2017 + tasks: *ref_3 + - name: windows-64-vs2017-erbium + display_name: Windows (VS2017) Node Erbium + run_on: windows-64-vs2017-large + expansions: + NODE_LTS_NAME: erbium + MSVS_VERSION: 2017 + tasks: *ref_3 - name: lint display_name: lint run_on: rhel70 diff --git a/.evergreen/config.yml.in b/.evergreen/config.yml.in index 14b4afd13a0..0a8e85f7c81 100644 --- a/.evergreen/config.yml.in +++ b/.evergreen/config.yml.in @@ -26,10 +26,8 @@ functions: - command: git.get_project params: directory: "src" - # Applies the submitted patch, if any - # Deprecated. Should be removed. But still needed for certain agents (ZAP) - - command: git.apply_patch - # Make an evergreen exapanstion file with dynamic values + shallow_clone: true # speed things up by limiting clone depth to 100 + # Make an evergreen expansion file with dynamic values - command: shell.exec params: working_dir: "src" @@ -42,11 +40,20 @@ functions: fi export DRIVERS_TOOLS="$(pwd)/../drivers-tools" + export PROJECT_DIRECTORY="$(pwd)" export MONGO_ORCHESTRATION_HOME="$DRIVERS_TOOLS/.evergreen/orchestration" export MONGODB_BINARIES="$DRIVERS_TOOLS/mongodb/bin" export UPLOAD_BUCKET="${project}" + # fix paths on windows + if [ "Windows_NT" = "$OS" ]; then + export DRIVERS_TOOLS=$(cygpath -m -a $DRIVERS_TOOLS) + export MONGO_ORCHESTRATION_HOME=$(cygpath -m -a $MONGO_ORCHESTRATION_HOME) + export MONGODB_BINARIES=$(cygpath -m -a $MONGODB_BINARIES) + export PROJECT_DIRECTORY=$(cygpath -m -a $PROJECT_DIRECTORY) + fi + cat < expansion.yml CURRENT_VERSION: "$CURRENT_VERSION" DRIVERS_TOOLS: "$DRIVERS_TOOLS" @@ -80,13 +87,7 @@ functions: params: script: | ${PREPARE_SHELL} - rm -rf $DRIVERS_TOOLS - if [ "${project}" = "drivers-tools" ]; then - # If this was a patch build, doing a fresh clone would not actually test the patch - cp -R ${PROJECT_DIRECTORY}/ $DRIVERS_TOOLS - else - git clone git://github.com/mongodb-labs/drivers-evergreen-tools.git $DRIVERS_TOOLS - fi + git clone --depth 1 git://github.com/mongodb-labs/drivers-evergreen-tools.git $DRIVERS_TOOLS echo "{ \"releases\": { \"default\": \"$MONGODB_BINARIES\" }}" > $MONGO_ORCHESTRATION_HOME/orchestration.config "bootstrap mongo-orchestration": @@ -134,6 +135,7 @@ functions: type: test params: working_dir: "src" + timeout_secs: 60 script: | ${PREPARE_SHELL} @@ -145,7 +147,8 @@ functions: fi AUTH=${AUTH} SSL=${SSL} UNIFIED=${UNIFIED} MONGODB_URI="${MONGODB_URI}" \ - bash ${PROJECT_DIRECTORY}/.evergreen/run-tests.sh + NODE_VERSION=${NODE_VERSION} SKIP_DEPS=1 NO_EXIT=1 \ + bash ${PROJECT_DIRECTORY}/.evergreen/run-tests.sh "run checks": - command: shell.exec @@ -159,6 +162,7 @@ functions: "cleanup": - command: shell.exec params: + silent: true script: | ${PREPARE_SHELL} rm -rf $DRIVERS_TOOLS || true @@ -166,27 +170,30 @@ functions: "fix absolute paths": - command: shell.exec params: + silent: true script: | ${PREPARE_SHELL} for filename in $(find ${DRIVERS_TOOLS} -name \*.json); do perl -p -i -e "s|ABSOLUTE_PATH_REPLACEMENT_TOKEN|${DRIVERS_TOOLS}|g" $filename done - # "windows fix": - # - command: shell.exec - # params: - # script: | - # ${PREPARE_SHELL} - # for i in $(find ${DRIVERS_TOOLS}/.evergreen ${PROJECT_DIRECTORY}/.evergreen -name \*.sh); do - # cat $i | tr -d '\r' > $i.new - # mv $i.new $i - # done - # # Copy client certificate because symlinks do not work on Windows. - # cp ${DRIVERS_TOOLS}/.evergreen/x509gen/client.pem ${MONGO_ORCHESTRATION_HOME}/lib/client.pem + "windows fix": + - command: shell.exec + params: + silent: true + script: | + ${PREPARE_SHELL} + # for i in $(find ${DRIVERS_TOOLS}/.evergreen ${PROJECT_DIRECTORY}/.evergreen -name \*.sh); do + # cat $i | tr -d '\r' > $i.new + # mv $i.new $i + # done + # Copy client certificate because symlinks do not work on Windows. + cp ${DRIVERS_TOOLS}/.evergreen/x509gen/client.pem ${MONGO_ORCHESTRATION_HOME}/lib/client.pem "make files executable": - command: shell.exec params: + silent: true script: | ${PREPARE_SHELL} for i in $(find ${DRIVERS_TOOLS}/.evergreen ${PROJECT_DIRECTORY}/.evergreen -name \*.sh); do @@ -200,7 +207,11 @@ functions: working_dir: "src" script: | ${PREPARE_SHELL} - NODE_LTS_NAME=${NODE_LTS_NAME} bash ${PROJECT_DIRECTORY}/.evergreen/install-dependencies.sh + NODE_LTS_NAME=${NODE_LTS_NAME} MSVS_VERSION=${MSVS_VERSION} \ + bash ${PROJECT_DIRECTORY}/.evergreen/install-dependencies.sh + - command: expansions.update + params: + file: src/deps-expansion.yml "run atlas tests": - command: shell.exec @@ -495,10 +506,13 @@ functions: pre: - func: "fetch source" - func: "prepare resources" - # - func: "windows fix" + - func: "windows fix" - func: "fix absolute paths" - func: "make files executable" post: - func: "upload test results" - func: "cleanup" + +ignore: + - '*.md' diff --git a/.evergreen/generate_evergreen_tasks.js b/.evergreen/generate_evergreen_tasks.js index e712aa3ec30..7d061a2cad9 100644 --- a/.evergreen/generate_evergreen_tasks.js +++ b/.evergreen/generate_evergreen_tasks.js @@ -1,5 +1,3 @@ -'use strict'; - const semver = require('semver'); const fs = require('fs'); const yaml = require('js-yaml'); @@ -26,33 +24,30 @@ const OPERATING_SYSTEMS = [ { name: 'ubuntu-14.04', display_name: 'Ubuntu 14.04', - run_on: 'ubuntu1404-test', + run_on: 'ubuntu1404-large', mongoVersion: '<4.2' }, { name: 'ubuntu-18.04', display_name: 'Ubuntu 18.04', - run_on: 'ubuntu1804-test', + run_on: 'ubuntu1804-large', mongoVersion: '>=3.2', clientEncryption: true }, - - // Windows. reenable this when nvm supports windows, or we settle on an alternative tool - // { - // name: 'windows-64-vs2010-test', - // display_name: 'Windows (VS2010)', - // run_on: 'windows-64-vs2010-test' - // }, - // { - // name: 'windows-64-vs2013-test', - // display_name: 'Windows (VS2013)', - // run_on: 'windows-64-vs2013-test' - // }, - // { - // name: 'windows-64-vs2015-test', - // display_name: 'Windows (VS2015)', - // run_on: 'windows-64-vs2015-test' - // } + { + name: 'windows-64-vs2015', + display_name: 'Windows (VS2015)', + run_on: 'windows-64-vs2015-large', + msvsVersion: 2015, + mongoVersion: '<4.4' + }, + { + name: 'windows-64-vs2017', + display_name: 'Windows (VS2017)', + run_on: 'windows-64-vs2017-large', + msvsVersion: 2017, + mongoVersion: '<4.4' + } ].map(osConfig => Object.assign( { @@ -67,10 +62,10 @@ const OPERATING_SYSTEMS = [ const TASKS = []; const SINGLETON_TASKS = []; -function makeTask({ mongoVersion, topology }) { +function makeTask({ mongoVersion, topology, tags = [] }) { return { name: `test-${mongoVersion}-${topology}`, - tags: [mongoVersion, topology], + tags: [mongoVersion, topology, ...tags], commands: [ { func: 'install dependencies' }, { @@ -85,10 +80,9 @@ function makeTask({ mongoVersion, topology }) { }; } +const BASE_TASKS = []; MONGODB_VERSIONS.forEach(mongoVersion => { - TOPOLOGIES.forEach(topology => - TASKS.push(makeTask({ mongoVersion, topology })) - ); + TOPOLOGIES.forEach(topology => BASE_TASKS.push(makeTask({ mongoVersion, topology }))); }); // manually added tasks @@ -96,13 +90,10 @@ Array.prototype.push.apply(TASKS, [ { name: 'test-atlas-connectivity', tags: ['atlas-connect'], - commands: [ - { func: 'install dependencies' }, - { func: 'run atlas tests' } - ] + commands: [{ func: 'install dependencies' }, { func: 'run atlas tests' }] }, { - name: "test-atlas-data-lake", + name: 'test-atlas-data-lake', commands: [ { func: 'install dependencies' }, { func: 'bootstrap mongohoused' }, @@ -112,18 +103,12 @@ Array.prototype.push.apply(TASKS, [ { name: 'test-auth-kerberos', tags: ['auth', 'kerberos'], - commands: [ - { func: 'install dependencies' }, - { func: 'run kerberos tests' } - ] + commands: [{ func: 'install dependencies' }, { func: 'run kerberos tests' }] }, { name: 'test-auth-ldap', tags: ['auth', 'ldap'], - commands: [ - { func: 'install dependencies' }, - { func: 'run ldap tests' } - ] + commands: [{ func: 'install dependencies' }, { func: 'run ldap tests' }] }, { name: 'test-tls-support', @@ -381,7 +366,7 @@ OCSP_VERSIONS.forEach(VERSION => { ] } ]); -}) +}); const AWS_AUTH_TASKS = []; @@ -410,35 +395,36 @@ AWS_AUTH_VERSIONS.forEach(VERSION => { { func: 'run aws ECS auth test' } ] }); -}) - +}); const BUILD_VARIANTS = []; const getTaskList = (() => { const memo = {}; - return function(mongoVersion) { - const key = mongoVersion; + return function (mongoVersion, onlyBaseTasks = false) { + const key = mongoVersion + (onlyBaseTasks ? 'b' : ''); if (memo[key]) { return memo[key]; } + const taskList = onlyBaseTasks ? BASE_TASKS : BASE_TASKS.concat(TASKS); + const ret = taskList + .filter(task => { + const tasksWithVars = task.commands.filter(task => !!task.vars); + if (task.name.match(/^aws/)) return false; - const ret = TASKS.filter(task => { - const tasksWithVars = task.commands.filter(task => !!task.vars); - if (task.name.match(/^aws/)) return false; - - if (!tasksWithVars.length) { - return true; - } + if (!tasksWithVars.length) { + return true; + } - const { VERSION } = task.commands.filter(task => !!task.vars)[0].vars; - if (VERSION === 'latest') { - return semver.satisfies(semver.coerce(LATEST_EFFECTIVE_VERSION), mongoVersion); - } + const { VERSION } = task.commands.filter(task => !!task.vars)[0].vars; + if (VERSION === 'latest') { + return semver.satisfies(semver.coerce(LATEST_EFFECTIVE_VERSION), mongoVersion); + } - return semver.satisfies(semver.coerce(VERSION), mongoVersion); - }).map(x => x.name); + return semver.satisfies(semver.coerce(VERSION), mongoVersion); + }) + .map(x => x.name); memo[key] = ret; return ret; @@ -452,10 +438,11 @@ OPERATING_SYSTEMS.forEach( run_on, mongoVersion = '>=2.6', nodeVersions = NODE_VERSIONS, - clientEncryption + clientEncryption, + msvsVersion }) => { const testedNodeVersions = NODE_VERSIONS.filter(version => nodeVersions.includes(version)); - const tasks = getTaskList(mongoVersion); + const tasks = getTaskList(mongoVersion, !!msvsVersion); testedNodeVersions.forEach(NODE_LTS_NAME => { const nodeLtsDisplayName = `Node ${NODE_LTS_NAME[0].toUpperCase()}${NODE_LTS_NAME.substr(1)}`; @@ -466,6 +453,9 @@ OPERATING_SYSTEMS.forEach( if (clientEncryption) { expansions.CLIENT_ENCRYPTION = true; } + if (msvsVersion) { + expansions.MSVS_VERSION = msvsVersion; + } BUILD_VARIANTS.push({ name, display_name, run_on, expansions, tasks }); }); @@ -507,7 +497,7 @@ BUILD_VARIANTS.push({ }); const fileData = yaml.safeLoad(fs.readFileSync(`${__dirname}/config.yml.in`, 'utf8')); -fileData.tasks = (fileData.tasks || []).concat(TASKS).concat(SINGLETON_TASKS); +fileData.tasks = (fileData.tasks || []).concat(BASE_TASKS).concat(TASKS).concat(SINGLETON_TASKS); fileData.buildvariants = (fileData.buildvariants || []).concat(BUILD_VARIANTS); fs.writeFileSync(`${__dirname}/config.yml`, yaml.safeDump(fileData, { lineWidth: 120 }), 'utf8'); diff --git a/.evergreen/install-dependencies.sh b/.evergreen/install-dependencies.sh index 69a3a880e8b..4c4f4f65d82 100644 --- a/.evergreen/install-dependencies.sh +++ b/.evergreen/install-dependencies.sh @@ -2,7 +2,11 @@ # set -o xtrace # Write all commands first to stderr set -o errexit # Exit the script with error if any of the commands fail +NVM_WINDOWS_URL="https://github.com/coreybutler/nvm-windows/releases/download/1.1.7/nvm-noinstall.zip" +NVM_URL="https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.3/install.sh" + NODE_LTS_NAME=${NODE_LTS_NAME:-carbon} +MSVS_VERSION=${MSVS_VERSION:-2017} NODE_ARTIFACTS_PATH="${PROJECT_DIRECTORY}/node-artifacts" NPM_CACHE_DIR="${NODE_ARTIFACTS_PATH}/npm" NPM_TMP_DIR="${NODE_ARTIFACTS_PATH}/tmp" @@ -16,19 +20,83 @@ mkdir -p ${NODE_ARTIFACTS_PATH} mkdir -p ${NPM_CACHE_DIR} mkdir -p "${NPM_TMP_DIR}" -# install Node.js -curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.35.3/install.sh | bash -[ -s "${NVM_DIR}/nvm.sh" ] && \. "${NVM_DIR}/nvm.sh" -nvm install --no-progress --lts=${NODE_LTS_NAME} +case $NODE_LTS_NAME in + "argon") + VERSION=4 + ;; + "boron") + VERSION=6 + ;; + "carbon") + VERSION=8 + ;; + "dubnium") + VERSION=10 + ;; + "erbium") + VERSION=12 + ;; + "fermium") + VERSION=14 + ;; + *) + echo "Unsupported Node LTS version $1" + exit 1 + ;; +esac +NODE_VERSION=$(curl --retry 8 --retry-delay 5 --max-time 50 -s -o- \ + https://nodejs.org/download/release/latest-v${VERSION}.x/SHASUMS256.txt \ +| head -n 1 | awk '{print $2};' | cut -d- -f2) +export NODE_VERSION=${NODE_VERSION:1} + +# output node version to expansions file for use in subsequent scripts +cat < deps-expansion.yml + NODE_VERSION: "$NODE_VERSION" +EOT + +# install Node.js on Windows +if [[ "$OS" == "Windows_NT" ]]; then + # Delete pre-existing node to avoid version conflicts + rm -rf "/cygdrive/c/Program Files/nodejs" + + export NVM_HOME=`cygpath -w "$NVM_DIR"` + export NVM_SYMLINK=`cygpath -w "$NODE_ARTIFACTS_PATH/bin"` + export NVM_ARTIFACTS_PATH=`cygpath -w "$NODE_ARTIFACTS_PATH/bin"` + export PATH=`cygpath $NVM_SYMLINK`:`cygpath $NVM_HOME`:$PATH + + curl -L $NVM_WINDOWS_URL -o nvm.zip + unzip -d $NVM_DIR nvm.zip + rm nvm.zip + + chmod 777 $NVM_DIR + chmod -R a+rx $NVM_DIR + + cat < $NVM_DIR/settings.txt +root: $NVM_HOME +path: $NVM_SYMLINK +EOT + nvm install $NODE_VERSION + nvm use $NODE_VERSION + which node || echo "node not found, PATH=$PATH" + which npm || echo "npm not found, PATH=$PATH" + npm config set msvs_version ${MSVS_VERSION} + npm config set scripts-prepend-node-path true + +# install Node.js on Linux/MacOS +else + curl -o- $NVM_URL | bash + [ -s "${NVM_DIR}/nvm.sh" ] && \. "${NVM_DIR}/nvm.sh" + nvm install --no-progress $NODE_VERSION -# setup npm cache in a local directory -cat < .npmrc + # setup npm cache in a local directory + cat < .npmrc devdir=${NPM_CACHE_DIR}/.node-gyp init-module=${NPM_CACHE_DIR}/.npm-init.js cache=${NPM_CACHE_DIR} tmp=${NPM_TMP_DIR} registry=https://registry.npmjs.org EOT +fi # NOTE: registry was overridden to not use artifactory, remove the `registry` line when # BUILD-6774 is resolved. diff --git a/.evergreen/run-tests.sh b/.evergreen/run-tests.sh index e65cc114fd4..dbb756b5599 100755 --- a/.evergreen/run-tests.sh +++ b/.evergreen/run-tests.sh @@ -8,10 +8,17 @@ set -o errexit # Exit the script with error if any of the commands fail # 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 "check:test" +# SKIP_DEPS Skip installing dependencies +# NO_EXIT Don't exit early from tests that leak resources AUTH=${AUTH:-noauth} UNIFIED=${UNIFIED:-} MONGODB_URI=${MONGODB_URI:-} +TEST_NPM_SCRIPT=${TEST_NPM_SCRIPT:-check:test} +if [[ -z "${NO_EXIT}" ]]; then + TEST_NPM_SCRIPT="$TEST_NPM_SCRIPT -- --exit" +fi # ssl setup SSL=${SSL:-nossl} @@ -23,10 +30,23 @@ fi # run tests echo "Running $AUTH tests over $SSL, connecting to $MONGODB_URI" -export PATH="/opt/mongodbtoolchain/v2/bin:$PATH" -NODE_ARTIFACTS_PATH="${PROJECT_DIRECTORY}/node-artifacts" -export NVM_DIR="${NODE_ARTIFACTS_PATH}/nvm" -[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" +if [[ -z "${SKIP_DEPS}" ]]; then + source "${PROJECT_DIRECTORY}/.evergreen/install-dependencies.sh" +else + export PATH="/opt/mongodbtoolchain/v2/bin:$PATH" + NODE_ARTIFACTS_PATH="${PROJECT_DIRECTORY}/node-artifacts" + export NVM_DIR="${NODE_ARTIFACTS_PATH}/nvm" + if [[ "$OS" == "Windows_NT" ]]; then + export NVM_HOME=`cygpath -m -a "$NVM_DIR"` + export NVM_SYMLINK=`cygpath -m -a "$NODE_ARTIFACTS_PATH/bin"` + export NVM_ARTIFACTS_PATH=`cygpath -m -a "$NODE_ARTIFACTS_PATH/bin"` + export PATH=`cygpath $NVM_SYMLINK`:`cygpath $NVM_HOME`:$PATH + echo "updated path on windows PATH=$PATH" + else + [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" + fi + echo "initializing NVM, NVM_DIR=$NVM_DIR" +fi # only run FLE tets on hosts we explicitly choose to test on if [[ -z "${CLIENT_ENCRYPTION}" ]]; then @@ -36,4 +56,4 @@ else npm install mongodb-client-encryption fi -MONGODB_UNIFIED_TOPOLOGY=${UNIFIED} MONGODB_URI=${MONGODB_URI} npm run check:test +MONGODB_UNIFIED_TOPOLOGY=${UNIFIED} MONGODB_URI=${MONGODB_URI} npm run ${TEST_NPM_SCRIPT} diff --git a/.mocharc.json b/.mocharc.json index 3bbb8ff4019..9d45eda6454 100644 --- a/.mocharc.json +++ b/.mocharc.json @@ -5,5 +5,6 @@ "ui": "test/tools/runner/metadata_ui.js", "recursive": true, "timeout": 60000, - "reporter": "spec-xunit-file" + "reporter": "spec-xunit-file", + "color": true } diff --git a/package-lock.json b/package-lock.json index 27b872a271a..6ee3670351f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -715,9 +715,9 @@ } }, "ansi-colors": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/ansi-colors/-/ansi-colors-4.1.1.tgz", - "integrity": "sha512-JoX0apGbHaUJBNl6yF+p6JAFYZ666/hhCGKN5t9QFjbJQKUU/g8MNbFDbvfrgKXvI1QpZplPOnwIo99lX/AAmA==", + "version": "3.2.3", + "resolved": "https://registry.npmjs.org/ansi-colors/-/ansi-colors-3.2.3.tgz", + "integrity": "sha512-LEHHyuhlPY3TmuUYMh2oz89lTShfvgbmzaBcxve9t/9Wuy7Dwf4yoAKcND7KFT1HAQfqZ12qtc+DUrBMeKF9nw==", "dev": true }, "ansi-escapes": { @@ -832,18 +832,6 @@ "integrity": "sha1-nlKHYrSpBmrRY6aWKjZEGOlibs4=", "dev": true }, - "array.prototype.map": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/array.prototype.map/-/array.prototype.map-1.0.2.tgz", - "integrity": "sha512-Az3OYxgsa1g7xDYp86l0nnN4bcmuEITGe1rbdEBVkrqkzMgDcbdQ2R7r41pNzti+4NMces3H8gMmuioZUilLgw==", - "dev": true, - "requires": { - "define-properties": "^1.1.3", - "es-abstract": "^1.17.0-next.1", - "es-array-method-boxes-properly": "^1.0.0", - "is-string": "^1.0.4" - } - }, "arrify": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/arrify/-/arrify-1.0.1.tgz", @@ -1057,6 +1045,16 @@ } } }, + "call-bind": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.0.tgz", + "integrity": "sha512-AEXsYIyyDY3MCzbwdhzG3Jx1R0J2wetQyUynn6dYHAO+bg8l1k7jwZtRv4ryryFs7EP+NDlikJlVe59jr0cM2w==", + "dev": true, + "requires": { + "function-bind": "^1.1.1", + "get-intrinsic": "^1.0.0" + } + }, "callsites": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/callsites/-/callsites-3.1.0.tgz", @@ -1139,19 +1137,19 @@ "dev": true }, "chokidar": { - "version": "3.4.2", - "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.4.2.tgz", - "integrity": "sha512-IZHaDeBeI+sZJRX7lGcXsdzgvZqKv6sECqsbErJA4mHWfpRrD8B97kSFN4cQz6nGBGiuFia1MKR4d6c1o8Cv7A==", + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.3.0.tgz", + "integrity": "sha512-dGmKLDdT3Gdl7fBUe8XK+gAtGmzy5Fn0XkkWQuYxGIgWVPPse2CxFA5mtrlD0TOHaHjEUqkWNyP1XdHoJES/4A==", "dev": true, "requires": { "anymatch": "~3.1.1", "braces": "~3.0.2", - "fsevents": "~2.1.2", + "fsevents": "~2.1.1", "glob-parent": "~5.1.0", "is-binary-path": "~2.1.0", "is-glob": "~4.0.1", "normalize-path": "~3.0.0", - "readdirp": "~3.4.0" + "readdirp": "~3.2.0" } }, "chownr": { @@ -2189,50 +2187,36 @@ } }, "es-abstract": { - "version": "1.17.6", - "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.17.6.tgz", - "integrity": "sha512-Fr89bON3WFyUi5EvAeI48QTWX0AyekGgLA8H+c+7fbfCkJwRWRMLd8CQedNEyJuoYYhmtEqY92pgte1FAhBlhw==", + "version": "1.18.0-next.1", + "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.18.0-next.1.tgz", + "integrity": "sha512-I4UGspA0wpZXWENrdA0uHbnhte683t3qT/1VFH9aX2dA5PPSf6QW5HHXf5HImaqPmjXaVeVk4RGWnaylmV7uAA==", "dev": true, "requires": { "es-to-primitive": "^1.2.1", "function-bind": "^1.1.1", "has": "^1.0.3", "has-symbols": "^1.0.1", - "is-callable": "^1.2.0", - "is-regex": "^1.1.0", - "object-inspect": "^1.7.0", + "is-callable": "^1.2.2", + "is-negative-zero": "^2.0.0", + "is-regex": "^1.1.1", + "object-inspect": "^1.8.0", "object-keys": "^1.1.1", - "object.assign": "^4.1.0", + "object.assign": "^4.1.1", "string.prototype.trimend": "^1.0.1", "string.prototype.trimstart": "^1.0.1" - } - }, - "es-array-method-boxes-properly": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/es-array-method-boxes-properly/-/es-array-method-boxes-properly-1.0.0.tgz", - "integrity": "sha512-wd6JXUmyHmt8T5a2xreUwKcGPq6f1f+WwIJkijUqiGcJz1qqnZgP6XIK+QyIWU5lT7imeNxUll48bziG+TSYcA==", - "dev": true - }, - "es-get-iterator": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/es-get-iterator/-/es-get-iterator-1.1.0.tgz", - "integrity": "sha512-UfrmHuWQlNMTs35e1ypnvikg6jCz3SK8v8ImvmDsh36fCVUR1MqoFDiyn0/k52C8NqO3YsO8Oe0azeesNuqSsQ==", - "dev": true, - "requires": { - "es-abstract": "^1.17.4", - "has-symbols": "^1.0.1", - "is-arguments": "^1.0.4", - "is-map": "^2.0.1", - "is-set": "^2.0.1", - "is-string": "^1.0.5", - "isarray": "^2.0.5" }, "dependencies": { - "isarray": { - "version": "2.0.5", - "resolved": "https://registry.npmjs.org/isarray/-/isarray-2.0.5.tgz", - "integrity": "sha512-xHjhDr3cNBK0BzdUJSPXZntQUx/mwMS5Rw4A7lPJ90XGAO6ISP/ePDNuo0vhqOZU+UD5JoodwCAAoZQd3FeAKw==", - "dev": true + "object.assign": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/object.assign/-/object.assign-4.1.2.tgz", + "integrity": "sha512-ixT2L5THXsApyiUPYKmW+2EHpXXe5Ii3M+f4e+aJFAHao5amFRW6J0OO6c/LU8Be47utCx2GL89hxGB6XSmKuQ==", + "dev": true, + "requires": { + "call-bind": "^1.0.0", + "define-properties": "^1.1.3", + "has-symbols": "^1.0.1", + "object-keys": "^1.1.1" + } } } }, @@ -2653,19 +2637,18 @@ } }, "find-up": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/find-up/-/find-up-5.0.0.tgz", - "integrity": "sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng==", + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-3.0.0.tgz", + "integrity": "sha512-1yD6RmLI1XBfxugvORwlck6f75tYL+iR0jqwsOrOxMZyGYqUuDhJ0l4AXdO1iX/FTs9cBAMEk1gWSEx1kSbylg==", "dev": true, "requires": { - "locate-path": "^6.0.0", - "path-exists": "^4.0.0" + "locate-path": "^3.0.0" } }, "flat": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/flat/-/flat-4.1.0.tgz", - "integrity": "sha512-Px/TiLIznH7gEDlPXcUD4KnBusa6kR6ayRUVcnEAbreRIuhkqow/mun59BuRXwoYk7ZQOLW1ZM05ilIvK38hFw==", + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/flat/-/flat-4.1.1.tgz", + "integrity": "sha512-FmTtBsHskrU6FJ2VxCnsDb84wu9zhmO3cUX2kGFb5tuwhfXxGciiT0oRY+cck35QmG+NmGh5eLz6lLCpWTqwpA==", "dev": true, "requires": { "is-buffer": "~2.0.3" @@ -2913,6 +2896,17 @@ "integrity": "sha1-6td0q+5y4gQJQzoGY2YCPdaIekE=", "dev": true }, + "get-intrinsic": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.0.1.tgz", + "integrity": "sha512-ZnWP+AmS1VUaLgTRy47+zKtjTxz+0xMpx3I52i+aalBK1QP19ggLF3Db89KJX7kjfOfP2eoa01qc++GwPgufPg==", + "dev": true, + "requires": { + "function-bind": "^1.1.1", + "has": "^1.0.3", + "has-symbols": "^1.0.1" + } + }, "get-own-enumerable-property-symbols": { "version": "3.0.2", "resolved": "https://registry.npmjs.org/get-own-enumerable-property-symbols/-/get-own-enumerable-property-symbols-3.0.2.tgz", @@ -3670,12 +3664,6 @@ "integrity": "sha512-agE4QfB2Lkp9uICn7BAqoscw4SZP9kTE2hxiFI3jBPmXJfdqiahTbUuKGsMoN2GtqL9AxhYioAcVvgsb1HvRbA==", "dev": true }, - "is-arguments": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/is-arguments/-/is-arguments-1.0.4.tgz", - "integrity": "sha512-xPh0Rmt8NE65sNzvyUmWgI1tz3mKq74lGA0mL8LYZcoIzKOzDh6HmrYm3d18k60nHerC8A9Km8kYu87zfSFnLA==", - "dev": true - }, "is-arrayish": { "version": "0.2.1", "resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.2.1.tgz", @@ -3692,15 +3680,15 @@ } }, "is-buffer": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-2.0.4.tgz", - "integrity": "sha512-Kq1rokWXOPXWuaMAqZiJW4XxsmD9zGx9q4aePabbn3qCRGedtH7Cm+zV8WETitMfu1wdh+Rvd6w5egwSngUX2A==", + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-2.0.5.tgz", + "integrity": "sha512-i2R6zNFDwgEHJyQUtJEk0XFi1i0dPFn/oqjK3/vPCcDeJvW5NQ83V8QbicfF1SupOaB0h8ntgBC2YiE7dfyctQ==", "dev": true }, "is-callable": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.2.0.tgz", - "integrity": "sha512-pyVD9AaGLxtg6srb2Ng6ynWJqkHU9bEM087AKck0w8QwDarTfNcpIYoU8x8Hv2Icm8u6kFJM18Dag8lyqGkviw==", + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.2.2.tgz", + "integrity": "sha512-dnMqspv5nU3LoewK2N/y7KLtxtakvTuaCsU9FU50/QDmdbHNy/4/JuRtMHqRU22o3q+W89YQndQEeCVwK+3qrA==", "dev": true }, "is-core-module": { @@ -3751,10 +3739,10 @@ "integrity": "sha512-2HvIEKRoqS62guEC+qBjpvRubdX910WCMuJTZ+I9yvqKU2/12eSL549HMwtabb4oupdj2sMP50k+XJfB/8JE6w==", "dev": true }, - "is-map": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/is-map/-/is-map-2.0.1.tgz", - "integrity": "sha512-T/S49scO8plUiAOA2DBTBG3JHpn1yiw0kRp6dgiZ0v2/6twi5eiB0rHtHFH9ZIrvlWc6+4O+m4zg5+Z833aXgw==", + "is-negative-zero": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/is-negative-zero/-/is-negative-zero-2.0.0.tgz", + "integrity": "sha1-lVOxIbD6wohp2p7UWeIMdUN4hGE=", "dev": true }, "is-number": { @@ -3796,24 +3784,12 @@ "integrity": "sha1-CRtGoNZ8HtD+hfH4z93gBrslHUY=", "dev": true }, - "is-set": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/is-set/-/is-set-2.0.1.tgz", - "integrity": "sha512-eJEzOtVyenDs1TMzSQ3kU3K+E0GUS9sno+F0OBT97xsgcJsF9nXMBtkT9/kut5JEpM7oL7X/0qxR17K3mcwIAA==", - "dev": true - }, "is-stream": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-2.0.0.tgz", "integrity": "sha512-XCoy+WlUr7d1+Z8GgSuXmpuUFC9fOhRXglJMx+dwLKTkL44Cjd4W1Z5P+BQZpr+cR93aGP4S/s7Ftw6Nd/kiEw==", "dev": true }, - "is-string": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/is-string/-/is-string-1.0.5.tgz", - "integrity": "sha512-buY6VNRjhQMiF1qWDouloZlQbRhDPCebwxSjxMjxgemYT46YMd2NR0/H+fBhEfWX4A/w9TBJ+ol+okqJKFE6vQ==", - "dev": true - }, "is-symbol": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/is-symbol/-/is-symbol-1.0.3.tgz", @@ -4045,22 +4021,6 @@ "istanbul-lib-report": "^3.0.0" } }, - "iterate-iterator": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/iterate-iterator/-/iterate-iterator-1.0.1.tgz", - "integrity": "sha512-3Q6tudGN05kbkDQDI4CqjaBf4qf85w6W6GnuZDtUVYwKgtC1q8yxYX7CZed7N+tLzQqS6roujWvszf13T+n9aw==", - "dev": true - }, - "iterate-value": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/iterate-value/-/iterate-value-1.0.2.tgz", - "integrity": "sha512-A6fMAio4D2ot2r/TYzr4yUWrmwNdsN5xL7+HUiyACE4DXm+q8HtPcnFTp+NnW3k4N05tZ7FVYFFb2CR13NxyHQ==", - "dev": true, - "requires": { - "es-get-iterator": "^1.0.2", - "iterate-iterator": "^1.0.1" - } - }, "jju": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/jju/-/jju-1.4.0.tgz", @@ -4310,12 +4270,21 @@ } }, "locate-path": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-6.0.0.tgz", - "integrity": "sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw==", + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-3.0.0.tgz", + "integrity": "sha512-7AO748wWnIhNqAuaty2ZWHkQHRSNfPVIsPIfwEOWO22AmaoVrWavlOcMR5nzTLNYvp36X220/maaRsrec1G65A==", "dev": true, "requires": { - "p-locate": "^5.0.0" + "p-locate": "^3.0.0", + "path-exists": "^3.0.0" + }, + "dependencies": { + "path-exists": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-3.0.0.tgz", + "integrity": "sha1-zg6+ql94yxiSXqfYENe1mwEP1RU=", + "dev": true + } } }, "lodash": { @@ -4774,71 +4743,50 @@ } }, "mocha": { - "version": "8.1.3", - "resolved": "https://registry.npmjs.org/mocha/-/mocha-8.1.3.tgz", - "integrity": "sha512-ZbaYib4hT4PpF4bdSO2DohooKXIn4lDeiYqB+vTmCdr6l2woW0b6H3pf5x4sM5nwQMru9RvjjHYWVGltR50ZBw==", + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/mocha/-/mocha-7.1.1.tgz", + "integrity": "sha512-3qQsu3ijNS3GkWcccT5Zw0hf/rWvu1fTN9sPvEd81hlwsr30GX2GcDSSoBxo24IR8FelmrAydGC6/1J5QQP4WA==", "dev": true, "requires": { - "ansi-colors": "4.1.1", + "ansi-colors": "3.2.3", "browser-stdout": "1.3.1", - "chokidar": "3.4.2", - "debug": "4.1.1", - "diff": "4.0.2", - "escape-string-regexp": "4.0.0", - "find-up": "5.0.0", - "glob": "7.1.6", + "chokidar": "3.3.0", + "debug": "3.2.6", + "diff": "3.5.0", + "escape-string-regexp": "1.0.5", + "find-up": "3.0.0", + "glob": "7.1.3", "growl": "1.10.5", "he": "1.2.0", - "js-yaml": "3.14.0", - "log-symbols": "4.0.0", + "js-yaml": "3.13.1", + "log-symbols": "3.0.0", "minimatch": "3.0.4", - "ms": "2.1.2", + "mkdirp": "0.5.3", + "ms": "2.1.1", + "node-environment-flags": "1.0.6", "object.assign": "4.1.0", - "promise.allsettled": "1.0.2", - "serialize-javascript": "4.0.0", - "strip-json-comments": "3.0.1", - "supports-color": "7.1.0", - "which": "2.0.2", + "strip-json-comments": "2.0.1", + "supports-color": "6.0.0", + "which": "1.3.1", "wide-align": "1.1.3", - "workerpool": "6.0.0", "yargs": "13.3.2", "yargs-parser": "13.1.2", - "yargs-unparser": "1.6.1" + "yargs-unparser": "1.6.0" }, "dependencies": { - "ansi-styles": { - "version": "4.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.2.1.tgz", - "integrity": "sha512-9VGjrMsG1vePxcSweQsN20KY/c4zN0h9fLjqAbwbPfahM3t+NL+M9HC8xeXG2I8pX5NoamTGNuomEUFI7fcUjA==", - "dev": true, - "requires": { - "@types/color-name": "^1.1.1", - "color-convert": "^2.0.1" - } - }, - "chalk": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.0.tgz", - "integrity": "sha512-qwx12AxXe2Q5xQ43Ac//I6v5aXTipYrSESdOgzrN+9XjgEpyjpKuvSGaN4qE93f7TQTlerQQ8S+EQ0EyDoVL1A==", - "dev": true, - "requires": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - } - }, - "color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "debug": { + "version": "3.2.6", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.6.tgz", + "integrity": "sha512-mel+jf7nrtEl5Pn1Qx46zARXKDpBbvzezse7p7LqINmdoIk8PYP5SySaxEmYv6TZ0JyEKA1hsCId6DIhgITtWQ==", "dev": true, "requires": { - "color-name": "~1.1.4" + "ms": "^2.1.1" } }, - "color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "diff": { + "version": "3.5.0", + "resolved": "https://registry.npmjs.org/diff/-/diff-3.5.0.tgz", + "integrity": "sha512-A46qtFgd+g7pDZinpnwiRJtxbC1hpgf0uzP3iG89scHk0AUC7A1TGxf5OiiOUv/JMZR8GOt8hL900hV0bOy5xA==", "dev": true }, "emoji-regex": { @@ -4847,17 +4795,19 @@ "integrity": "sha512-CwBLREIQ7LvYFB0WyRvwhq5N5qPhc6PMjD6bYggFlI5YyDgl+0vxq5VHbMOFqLg7hfWzmu8T5Z1QofhmTIhItA==", "dev": true }, - "escape-string-regexp": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz", - "integrity": "sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==", - "dev": true - }, - "has-flag": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", - "dev": true + "glob": { + "version": "7.1.3", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.3.tgz", + "integrity": "sha512-vcfuiIxogLV4DlGBHIUOwI0IbrJ8HWPc4MU7HzviGeNho/UJDfi6B5p3sHeWIQ0KGIU0Jpxi5ZHxemQfLkkAwQ==", + "dev": true, + "requires": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.0.4", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + } }, "is-fullwidth-code-point": { "version": "2.0.0", @@ -4865,47 +4815,29 @@ "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=", "dev": true }, - "locate-path": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-3.0.0.tgz", - "integrity": "sha512-7AO748wWnIhNqAuaty2ZWHkQHRSNfPVIsPIfwEOWO22AmaoVrWavlOcMR5nzTLNYvp36X220/maaRsrec1G65A==", - "dev": true, - "requires": { - "p-locate": "^3.0.0", - "path-exists": "^3.0.0" - } - }, - "log-symbols": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/log-symbols/-/log-symbols-4.0.0.tgz", - "integrity": "sha512-FN8JBzLx6CzeMrB0tg6pqlGU1wCrXW+ZXGH481kfsBqer0hToTIiHdjH4Mq8xJUbvATujKCvaREGWpGUionraA==", - "dev": true, - "requires": { - "chalk": "^4.0.0" - } - }, - "p-limit": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz", - "integrity": "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==", + "js-yaml": { + "version": "3.13.1", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.13.1.tgz", + "integrity": "sha512-YfbcO7jXDdyj0DGxYVSlSeQNHbD7XPWvrVWeVUujrQEoZzWJIRrCPoyk6kL6IAjAG2IolMK4T0hNUe0HOUs5Jw==", "dev": true, "requires": { - "p-try": "^2.0.0" + "argparse": "^1.0.7", + "esprima": "^4.0.0" } }, - "p-locate": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-3.0.0.tgz", - "integrity": "sha512-x+12w/To+4GFfgJhBEpiDcLozRJGegY+Ei7/z0tSLkMmxGZNybVMSfWj9aJn8Z5Fc7dBUNJOOVgPv2H7IwulSQ==", + "mkdirp": { + "version": "0.5.3", + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.3.tgz", + "integrity": "sha512-P+2gwrFqx8lhew375MQHHeTlY8AuOJSrGf0R5ddkEndUkmwpgUob/vQuBD1V22/Cw1/lJr4x+EjllSezBThzBg==", "dev": true, "requires": { - "p-limit": "^2.0.0" + "minimist": "^1.2.5" } }, - "path-exists": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-3.0.0.tgz", - "integrity": "sha1-zg6+ql94yxiSXqfYENe1mwEP1RU=", + "ms": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.1.tgz", + "integrity": "sha512-tgp+dl5cGk28utYktBsrFqA7HKgrhgPsg6Z/EfhWI4gl1Hwq8B/GmY/0oXZ6nF8hDVesS/FpnYaD/kOWhYQvyg==", "dev": true }, "string-width": { @@ -4920,27 +4852,18 @@ } }, "strip-json-comments": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.0.1.tgz", - "integrity": "sha512-VTyMAUfdm047mwKl+u79WIdrZxtFtn+nBxHeb844XBQ9uMNTuTHdx2hc5RiAJYqwTj3wc/xe5HLSdJSkJ+WfZw==", + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-2.0.1.tgz", + "integrity": "sha1-PFMZQukIwml8DsNEhYwobHygpgo=", "dev": true }, "supports-color": { - "version": "7.1.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.1.0.tgz", - "integrity": "sha512-oRSIpR8pxT1Wr2FquTNnGet79b3BWljqOuoW/h4oBhxJ/HUbX5nX6JSruTkvXDCFMwDPvsaTTbvMLKZWSy0R5g==", - "dev": true, - "requires": { - "has-flag": "^4.0.0" - } - }, - "which": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", - "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-6.0.0.tgz", + "integrity": "sha512-on9Kwidc1IUQo+bQdhi8+Tijpo0e1SS6RoGo2guUwn5vdaxw8RXOF9Vb2ws+ihWOmh4JnCJOvaziZWP1VABaLg==", "dev": true, "requires": { - "isexe": "^2.0.0" + "has-flag": "^3.0.0" } }, "yargs": { @@ -4959,17 +4882,6 @@ "which-module": "^2.0.0", "y18n": "^4.0.0", "yargs-parser": "^13.1.2" - }, - "dependencies": { - "find-up": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/find-up/-/find-up-3.0.0.tgz", - "integrity": "sha512-1yD6RmLI1XBfxugvORwlck6f75tYL+iR0jqwsOrOxMZyGYqUuDhJ0l4AXdO1iX/FTs9cBAMEk1gWSEx1kSbylg==", - "dev": true, - "requires": { - "locate-path": "^3.0.0" - } - } } } } @@ -5105,6 +5017,16 @@ "semver": "^5.4.1" } }, + "node-environment-flags": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/node-environment-flags/-/node-environment-flags-1.0.6.tgz", + "integrity": "sha512-5Evy2epuL+6TM0lCQGpFIj6KwiEsGh1SrHUhTbNX+sLbBtjidPZFAnVK9y5yU1+h//RitLbRHTIMyxQPtxMdHw==", + "dev": true, + "requires": { + "object.getownpropertydescriptors": "^2.0.3", + "semver": "^5.7.0" + } + }, "node-preload": { "version": "0.2.1", "resolved": "https://registry.npmjs.org/node-preload/-/node-preload-0.2.1.tgz", @@ -5387,6 +5309,17 @@ "object-keys": "^1.0.11" } }, + "object.getownpropertydescriptors": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/object.getownpropertydescriptors/-/object.getownpropertydescriptors-2.1.1.tgz", + "integrity": "sha512-6DtXgZ/lIZ9hqx4GtZETobXLR/ZLaa0aqV0kzbn80Rf8Z2e/XFnhA0I7p07N2wH8bBBltr2xQPi6sbKWAY2Eng==", + "dev": true, + "requires": { + "call-bind": "^1.0.0", + "define-properties": "^1.1.3", + "es-abstract": "^1.18.0-next.1" + } + }, "once": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", @@ -5509,21 +5442,21 @@ "dev": true }, "p-limit": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-3.0.2.tgz", - "integrity": "sha512-iwqZSOoWIW+Ew4kAGUlN16J4M7OB3ysMLSZtnhmqx7njIHFPlxWBX8xo3lVTyFVq6mI/lL9qt2IsN1sHwaxJkg==", + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz", + "integrity": "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==", "dev": true, "requires": { "p-try": "^2.0.0" } }, "p-locate": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-5.0.0.tgz", - "integrity": "sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw==", + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-3.0.0.tgz", + "integrity": "sha512-x+12w/To+4GFfgJhBEpiDcLozRJGegY+Ei7/z0tSLkMmxGZNybVMSfWj9aJn8Z5Fc7dBUNJOOVgPv2H7IwulSQ==", "dev": true, "requires": { - "p-limit": "^3.0.2" + "p-limit": "^2.0.0" } }, "p-map": { @@ -5867,19 +5800,6 @@ "integrity": "sha512-7PiHtLll5LdnKIMw100I+8xJXR5gW2QwWYkT6iJva0bXitZKa/XMrSbdmg3r2Xnaidz9Qumd0VPaMrZlF9V9sA==", "dev": true }, - "promise.allsettled": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/promise.allsettled/-/promise.allsettled-1.0.2.tgz", - "integrity": "sha512-UpcYW5S1RaNKT6pd+s9jp9K9rlQge1UXKskec0j6Mmuq7UJCvlS2J2/s/yuPN8ehftf9HXMxWlKiPbGGUzpoRg==", - "dev": true, - "requires": { - "array.prototype.map": "^1.0.1", - "define-properties": "^1.1.3", - "es-abstract": "^1.17.0-next.1", - "function-bind": "^1.1.1", - "iterate-value": "^1.0.0" - } - }, "prr": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/prr/-/prr-1.0.1.tgz", @@ -5926,15 +5846,6 @@ "integrity": "sha512-ARhCpm70fzdcvNQfPoy49IaanKkTlRWF2JMzqhcJbhSFRZv7nPTvZJdcY7301IPmvW+/p0RgIWnQDLJxifsQ7g==", "dev": true }, - "randombytes": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/randombytes/-/randombytes-2.1.0.tgz", - "integrity": "sha512-vYl3iOX+4CKUWuxGi9Ukhie6fsqXqS9FE2Zaic4tNFD2N2QQaXOMFbuKK4QmDHC0JO6B1Zp41J0LpT0oR68amQ==", - "dev": true, - "requires": { - "safe-buffer": "^5.1.0" - } - }, "rc": { "version": "1.2.8", "resolved": "https://registry.npmjs.org/rc/-/rc-1.2.8.tgz", @@ -6094,12 +6005,12 @@ } }, "readdirp": { - "version": "3.4.0", - "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.4.0.tgz", - "integrity": "sha512-0xe001vZBnJEK+uKcj8qOhyAKPzIT+gStxWr3LCB0DwcXR5NZJ3IaC+yGnHCYzB/S7ov3m3EEbZI2zeNvX+hGQ==", + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.2.0.tgz", + "integrity": "sha512-crk4Qu3pmXwgxdSgGhgA/eXiJAPQiX4GMOZZMXnqKxHX7TaoL+3gQVo/WeuAiogr07DpnfjIMpXXa+PAIvwPGQ==", "dev": true, "requires": { - "picomatch": "^2.2.1" + "picomatch": "^2.0.4" } }, "rechoir": { @@ -6313,15 +6224,6 @@ "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==", "dev": true }, - "serialize-javascript": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/serialize-javascript/-/serialize-javascript-4.0.0.tgz", - "integrity": "sha512-GaNA54380uFefWghODBWEGisLZFj00nS5ACs6yHa9nLqlLpVLO8ChDGeKRjZnV4Nh4n0Qi7nhYZD/9fCPzEqkw==", - "dev": true, - "requires": { - "randombytes": "^2.1.0" - } - }, "set-blocking": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/set-blocking/-/set-blocking-2.0.0.tgz", @@ -6783,23 +6685,23 @@ } }, "string.prototype.trimend": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/string.prototype.trimend/-/string.prototype.trimend-1.0.1.tgz", - "integrity": "sha512-LRPxFUaTtpqYsTeNKaFOw3R4bxIzWOnbQ837QfBylo8jIxtcbK/A/sMV7Q+OAV/vWo+7s25pOE10KYSjaSO06g==", + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/string.prototype.trimend/-/string.prototype.trimend-1.0.3.tgz", + "integrity": "sha512-ayH0pB+uf0U28CtjlLvL7NaohvR1amUvVZk+y3DYb0Ey2PUV5zPkkKy9+U1ndVEIXO8hNg18eIv9Jntbii+dKw==", "dev": true, "requires": { - "define-properties": "^1.1.3", - "es-abstract": "^1.17.5" + "call-bind": "^1.0.0", + "define-properties": "^1.1.3" } }, "string.prototype.trimstart": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/string.prototype.trimstart/-/string.prototype.trimstart-1.0.1.tgz", - "integrity": "sha512-XxZn+QpvrBI1FOcg6dIpxUPgWCPuNXvMD72aaRaUQv1eD4e/Qy8i/hFTe0BUmD60p/QA6bh1avmuPTfNjqVWRw==", + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/string.prototype.trimstart/-/string.prototype.trimstart-1.0.3.tgz", + "integrity": "sha512-oBIBUy5lea5tt0ovtOFiEQaBkoBBkyJhZXzJYrSmDo5IUUqbOPvVezuRs/agBIdZ2p2Eo1FD6bD9USyBLfl3xg==", "dev": true, "requires": { - "define-properties": "^1.1.3", - "es-abstract": "^1.17.5" + "call-bind": "^1.0.0", + "define-properties": "^1.1.3" } }, "string_decoder": { @@ -7492,12 +7394,6 @@ "errno": "~0.1.7" } }, - "workerpool": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/workerpool/-/workerpool-6.0.0.tgz", - "integrity": "sha512-fU2OcNA/GVAJLLyKUoHkAgIhKb0JoCpSjLC/G2vYKxUjVmQwGbRVeoPJ1a8U4pnVofz4AQV5Y/NEw8oKqxEBtA==", - "dev": true - }, "wrap-ansi": { "version": "5.1.0", "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-5.1.0.tgz", @@ -7693,16 +7589,57 @@ } }, "yargs-unparser": { - "version": "1.6.1", - "resolved": "https://registry.npmjs.org/yargs-unparser/-/yargs-unparser-1.6.1.tgz", - "integrity": "sha512-qZV14lK9MWsGCmcr7u5oXGH0dbGqZAIxTDrWXZDo5zUr6b6iUmelNKO6x6R1dQT24AH3LgRxJpr8meWy2unolA==", + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/yargs-unparser/-/yargs-unparser-1.6.0.tgz", + "integrity": "sha512-W9tKgmSn0DpSatfri0nx52Joq5hVXgeLiqR/5G0sZNDoLZFOr/xjBUDcShCOGNsBnEMNo1KAMBkTej1Hm62HTw==", "dev": true, "requires": { - "camelcase": "^5.3.1", - "decamelize": "^1.2.0", "flat": "^4.1.0", - "is-plain-obj": "^1.1.0", - "yargs": "^14.2.3" + "lodash": "^4.17.15", + "yargs": "^13.3.0" + }, + "dependencies": { + "emoji-regex": { + "version": "7.0.3", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-7.0.3.tgz", + "integrity": "sha512-CwBLREIQ7LvYFB0WyRvwhq5N5qPhc6PMjD6bYggFlI5YyDgl+0vxq5VHbMOFqLg7hfWzmu8T5Z1QofhmTIhItA==", + "dev": true + }, + "is-fullwidth-code-point": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz", + "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=", + "dev": true + }, + "string-width": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-3.1.0.tgz", + "integrity": "sha512-vafcv6KjVZKSgz06oM/H6GDBrAtz8vdhQakGjFIvNrHA6y3HCF1CInLy+QLq8dTJPQ1b+KDUqDFctkdRW44e1w==", + "dev": true, + "requires": { + "emoji-regex": "^7.0.1", + "is-fullwidth-code-point": "^2.0.0", + "strip-ansi": "^5.1.0" + } + }, + "yargs": { + "version": "13.3.2", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-13.3.2.tgz", + "integrity": "sha512-AX3Zw5iPruN5ie6xGRIDgqkT+ZhnRlZMLMHAs8tg7nRruy2Nb+i5o9bwghAogtM08q1dpr2LVoS8KSTMYpWXUw==", + "dev": true, + "requires": { + "cliui": "^5.0.0", + "find-up": "^3.0.0", + "get-caller-file": "^2.0.1", + "require-directory": "^2.1.1", + "require-main-filename": "^2.0.0", + "set-blocking": "^2.0.0", + "string-width": "^3.0.0", + "which-module": "^2.0.0", + "y18n": "^4.0.0", + "yargs-parser": "^13.1.2" + } + } } }, "yn": { diff --git a/package.json b/package.json index 96a72e4d044..626dea7cf46 100644 --- a/package.json +++ b/package.json @@ -55,7 +55,7 @@ "jsdoc": "^3.6.4", "lodash.camelcase": "^4.3.0", "madge": "^3.9.0", - "mocha": "^8.1.3", + "mocha": "^7.1.1", "mocha-sinon": "^2.1.0", "mongodb-mock-server": "^2.0.1", "nyc": "^15.1.0", diff --git a/test/disabled/rs_mocks/connection.test.js b/test/disabled/rs_mocks/connection.test.js index ca3fbb840c8..d2e47540b92 100644 --- a/test/disabled/rs_mocks/connection.test.js +++ b/test/disabled/rs_mocks/connection.test.js @@ -267,7 +267,8 @@ describe('ReplSet Connection Tests (mocks)', function () { metadata: { requires: { generators: true, - topology: 'single' + topology: 'single', + os: '!win32' // NODE-2943: timeout on windows } }, @@ -375,7 +376,8 @@ describe('ReplSet Connection Tests (mocks)', function () { metadata: { requires: { generators: true, - topology: 'single' + topology: 'single', + os: '!win32' // NODE-2943: timeout on windows } }, diff --git a/test/functional/change_stream.test.js b/test/functional/change_stream.test.js index 93566d4c846..b2cf12f1a1c 100644 --- a/test/functional/change_stream.test.js +++ b/test/functional/change_stream.test.js @@ -1,5 +1,4 @@ 'use strict'; -const path = require('path'); const assert = require('assert'); const { Transform, PassThrough } = require('stream'); const { MongoNetworkError } = require('../../src/error'); @@ -11,6 +10,8 @@ const expect = chai.expect; const sinon = require('sinon'); const { ObjectId, Timestamp, Long, ReadPreference } = require('../../src'); const fs = require('fs'); +const os = require('os'); +const path = require('path'); const crypto = require('crypto'); chai.use(require('chai-subset')); @@ -1460,13 +1461,14 @@ describe('Change Streams', function () { it('should resume piping of Change Streams when a resumable error is encountered', { metadata: { requires: { + os: '!win32', // (fs.watch isn't reliable on win32) generators: true, topology: 'single', mongodb: '>=3.6' } }, test: function (done) { - const filename = path.join(__dirname, '_nodemongodbnative_resumepipe.txt'); + const filename = path.join(os.tmpdir(), '_nodemongodbnative_resumepipe.txt'); this.defer(() => fs.unlinkSync(filename)); const configuration = this.configuration; @@ -1578,6 +1580,7 @@ describe('Change Streams', function () { const changeStream = collection.watch(pipeline); const outStream = fs.createWriteStream(filename); + this.defer(() => outStream.close()); changeStream.stream({ transform: JSON.stringify }).pipe(outStream); this.defer(() => changeStream.close()); diff --git a/test/functional/cmap/connection.test.js b/test/functional/cmap/connection.test.js index 3d44c352084..f9119343db0 100644 --- a/test/functional/cmap/connection.test.js +++ b/test/functional/cmap/connection.test.js @@ -55,18 +55,25 @@ describe('Connection', function () { }); }); - it('should support socket timeouts', function (done) { - const connectOptions = Object.assign({ - host: '240.0.0.1', - connectionType: Connection, - connectionTimeout: 500 - }); + it('should support socket timeouts', { + metadata: { + requires: { + os: '!win32' // NODE-2941: 240.0.0.1 doesnt work for windows + } + }, + test: function (done) { + const connectOptions = Object.assign({ + host: '240.0.0.1', + connectionType: Connection, + connectionTimeout: 500 + }); - connect(connectOptions, err => { - expect(err).to.exist; - expect(err).to.match(/timed out/); - done(); - }); + connect(connectOptions, err => { + expect(err).to.exist; + expect(err).to.match(/timed out/); + done(); + }); + } }); it('should support calling back multiple times on exhaust commands', { diff --git a/test/functional/connection.test.js b/test/functional/connection.test.js index 98c40d66083..cef963169f1 100644 --- a/test/functional/connection.test.js +++ b/test/functional/connection.test.js @@ -9,7 +9,7 @@ describe('Connection', function () { }); it('should correctly start monitoring for single server connection', { - metadata: { requires: { topology: 'single' } }, + metadata: { requires: { topology: 'single', os: '!win32' } }, test: function (done) { var configuration = this.configuration; @@ -29,7 +29,7 @@ describe('Connection', function () { }); it('should correctly connect to server using domain socket', { - metadata: { requires: { topology: 'single' } }, + metadata: { requires: { topology: 'single', os: '!win32' } }, test: function (done) { var configuration = this.configuration; @@ -97,7 +97,7 @@ describe('Connection', function () { }); it('should connect to server using domain socket with undefined port', { - metadata: { requires: { topology: 'single' } }, + metadata: { requires: { topology: 'single', os: '!win32' } }, test: function (done) { var configuration = this.configuration; diff --git a/test/functional/cursor.test.js b/test/functional/cursor.test.js index fe3975ee7e8..580f54e28ed 100644 --- a/test/functional/cursor.test.js +++ b/test/functional/cursor.test.js @@ -2,6 +2,8 @@ const { assert: test, filterForCommands, withMonitoredClient } = require('./shared'); const { setupDatabase } = require('./shared'); const fs = require('fs'); +const os = require('os'); +const path = require('path'); const { expect } = require('chai'); const BSON = require('bson'); const sinon = require('sinon'); @@ -1840,7 +1842,7 @@ describe('Cursor', function () { collection.insertMany(docs, configuration.writeConcernMax(), err => { expect(err).to.not.exist; - const filename = '/tmp/_nodemongodbnative_stream_out.txt'; + const filename = path.join(os.tmpdir(), '_nodemongodbnative_stream_out.txt'); const out = fs.createWriteStream(filename); const stream = collection.find().stream({ transform: doc => JSON.stringify(doc) @@ -1869,12 +1871,13 @@ describe('Cursor', function () { } }); - it('shouldCloseDeadTailableCursors', { + it('should close dead tailable cursors', { // Add a tag that our runner can trigger on // in this case we are setting that node needs to be higher than 0.10.X to run metadata: { requires: { topology: ['single', 'replicaset', 'sharded', 'ssl', 'heap', 'wiredtiger'] }, - sessions: { skipLeakTests: true } + sessions: { skipLeakTests: true }, + os: '!win32' // NODE-2943: timeout on windows }, test: function (done) { diff --git a/test/functional/mongo_client.test.js b/test/functional/mongo_client.test.js index 16be1024734..d9039c7ecd5 100644 --- a/test/functional/mongo_client.test.js +++ b/test/functional/mongo_client.test.js @@ -93,7 +93,7 @@ describe('MongoClient', function () { }); it('should correctly connect to mongodb using domain socket', { - metadata: { requires: { topology: ['single'] } }, + metadata: { requires: { topology: ['single'], os: '!win32' } }, test: function (done) { var configuration = this.configuration; diff --git a/test/functional/operation_example.test.js b/test/functional/operation_example.test.js index 2f160c98c14..0a6491cdb18 100644 --- a/test/functional/operation_example.test.js +++ b/test/functional/operation_example.test.js @@ -3583,7 +3583,7 @@ describe('Operation Examples', function () { * @example-class Db * @example-method createCollection */ - it('shouldCorrectlyCreateACollection', { + it('should correctly create a collection', { metadata: { requires: { topology: ['single', 'replicaset', 'sharded', 'ssl', 'heap', 'wiredtiger'] } }, @@ -6710,7 +6710,7 @@ describe('Operation Examples', function () { // Create a capped collection with a maximum of 1000 documents db.createCollection( 'a_simple_collection_2', - { capped: true, size: 100000, max: 10000, writeConcern: { w: 1 } }, + { capped: true, size: 100000, max: 1000, writeConcern: { w: 1 } }, function (err, collection) { expect(err).to.not.exist; diff --git a/test/functional/operation_generators_example.test.js b/test/functional/operation_generators_example.test.js index 144d33676d8..e9faf7c23a2 100644 --- a/test/functional/operation_generators_example.test.js +++ b/test/functional/operation_generators_example.test.js @@ -4620,7 +4620,7 @@ describe('Operation (Generators)', function () { var collection = yield db.createCollection('a_simple_collection_2_with_generators', { capped: true, size: 100000, - max: 10000, + max: 1000, writeConcern: { w: 1 } }); var docs = []; diff --git a/test/functional/operation_promises_example.test.js b/test/functional/operation_promises_example.test.js index 8d27856c6bd..9414fdcf537 100644 --- a/test/functional/operation_promises_example.test.js +++ b/test/functional/operation_promises_example.test.js @@ -4943,7 +4943,7 @@ describe('Operation (Promises)', function () { db.createCollection('a_simple_collection_2_with_promise', { capped: true, size: 100000, - max: 10000, + max: 1000, writeConcern: { w: 1 } }) .then(function (_collection) { diff --git a/test/tools/runner/filters/mongodb_topology_filter.js b/test/tools/runner/filters/mongodb_topology_filter.js index c55eda25cd1..9b585677780 100755 --- a/test/tools/runner/filters/mongodb_topology_filter.js +++ b/test/tools/runner/filters/mongodb_topology_filter.js @@ -7,7 +7,7 @@ const { TopologyType } = require('../../../../src/sdam/common'); * example: * metadata: { * requires: { - * topology: 'single' | 'replicaset' | 'sharded' | 'auth' | 'ssl' + * topology: 'single' | 'replicaset' | 'sharded' * } * } */ diff --git a/test/unit/core/connect.test.js b/test/unit/core/connect.test.js index 315ceaa7aa7..124cee68552 100644 --- a/test/unit/core/connect.test.js +++ b/test/unit/core/connect.test.js @@ -98,16 +98,23 @@ describe('Connect Tests', function () { }); }); - it('should allow a cancellaton token', function (done) { - const cancellationToken = new EventEmitter(); - setTimeout(() => cancellationToken.emit('cancel'), 500); - // set no response handler for mock server, effecively blackhole requests + it('should allow a cancellaton token', { + metadata: { + requires: { + os: '!win32' // NODE-2941: 240.0.0.1 doesnt work for windows + } + }, + test: function (done) { + const cancellationToken = new EventEmitter(); + setTimeout(() => cancellationToken.emit('cancel'), 500); + // set no response handler for mock server, effecively blackhole requests - connect({ host: '240.0.0.1' }, cancellationToken, (err, conn) => { - expect(err).to.exist; - expect(err).to.match(/connection establishment was cancelled/); - expect(conn).to.not.exist; - done(); - }); + connect({ host: '240.0.0.1' }, cancellationToken, (err, conn) => { + expect(err).to.exist; + expect(err).to.match(/connection establishment was cancelled/); + expect(conn).to.not.exist; + done(); + }); + } }); });