From 1f19f8f6ad8486acd1cbde2a919e391d36d21238 Mon Sep 17 00:00:00 2001 From: Eric Adum Date: Tue, 24 Nov 2020 15:14:07 -0500 Subject: [PATCH 01/10] chore(ci): skip broken windows tests, idle timeout, colors (#2629) --- .evergreen/config.yml | 1 + .evergreen/config.yml.in | 1 + test/functional/cmap/connection.test.js | 27 ++++++++++--------- test/functional/connection.test.js | 8 +++--- .../core/rs_mocks/connection.test.js | 6 +++-- test/functional/cursor.test.js | 5 +++- test/functional/mongo_client.test.js | 2 +- test/mocha.opts | 1 + test/unit/core/connect.test.js | 25 +++++++++-------- 9 files changed, 45 insertions(+), 31 deletions(-) diff --git a/.evergreen/config.yml b/.evergreen/config.yml index e22ced00e47..539e2a0146e 100644 --- a/.evergreen/config.yml +++ b/.evergreen/config.yml @@ -101,6 +101,7 @@ functions: type: test params: working_dir: src + timeout_secs: 60 script: | ${PREPARE_SHELL} diff --git a/.evergreen/config.yml.in b/.evergreen/config.yml.in index e450f48340f..fcd0f98d224 100644 --- a/.evergreen/config.yml.in +++ b/.evergreen/config.yml.in @@ -121,6 +121,7 @@ functions: type: test params: working_dir: "src" + timeout_secs: 60 script: | ${PREPARE_SHELL} diff --git a/test/functional/cmap/connection.test.js b/test/functional/cmap/connection.test.js index 121fa94ec5a..8b51ed22e12 100644 --- a/test/functional/cmap/connection.test.js +++ b/test/functional/cmap/connection.test.js @@ -61,19 +61,22 @@ describe('Connection', function() { }); }); - it('should support socket timeouts', function(done) { - const connectOptions = Object.assign({ - host: '240.0.0.1', - connectionType: Connection, - bson: new BSON(), - connectionTimeout: 500 - }); + it('should support socket timeouts', { + metadata: { requires: { os: '!win32' } }, + test: function(done) { + const connectOptions = Object.assign({ + host: '240.0.0.1', + connectionType: Connection, + bson: new BSON(), + 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 a75916eeb6f..2f56b47ce66 100644 --- a/test/functional/connection.test.js +++ b/test/functional/connection.test.js @@ -12,7 +12,7 @@ describe('Connection', function() { * @ignore */ it('should correctly start monitoring for single server connection', { - metadata: { requires: { topology: 'single' } }, + metadata: { requires: { topology: 'single', os: '!win32' } }, // The actual test we wish to run test: function(done) { @@ -36,7 +36,7 @@ describe('Connection', function() { * @ignore */ it('should correctly disable monitoring for single server connection', { - metadata: { requires: { topology: 'single' } }, + metadata: { requires: { topology: 'single', os: '!win32' } }, // The actual test we wish to run test: function(done) { @@ -64,7 +64,7 @@ describe('Connection', function() { * @ignore */ it('should correctly connect to server using domain socket', { - metadata: { requires: { topology: 'single' } }, + metadata: { requires: { topology: 'single', os: '!win32' } }, // The actual test we wish to run test: function(done) { @@ -161,7 +161,7 @@ describe('Connection', function() { * @ignore */ it('should connect to server using domain socket with undefined port', { - metadata: { requires: { topology: 'single' } }, + metadata: { requires: { topology: 'single', os: '!win32' } }, // The actual test we wish to run test: function(done) { diff --git a/test/functional/core/rs_mocks/connection.test.js b/test/functional/core/rs_mocks/connection.test.js index 34c4fb9a107..15f4e3e1201 100644 --- a/test/functional/core/rs_mocks/connection.test.js +++ b/test/functional/core/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' } }, @@ -375,7 +376,8 @@ describe('ReplSet Connection Tests (mocks)', function() { metadata: { requires: { generators: true, - topology: 'single' + topology: 'single', + os: '!win32' } }, diff --git a/test/functional/cursor.test.js b/test/functional/cursor.test.js index 64a07f2ab3b..2d51fc6d784 100644 --- a/test/functional/cursor.test.js +++ b/test/functional/cursor.test.js @@ -2216,7 +2216,10 @@ describe('Cursor', function() { // 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'] } + requires: { + topology: ['single', 'replicaset', 'sharded', 'ssl', 'heap', 'wiredtiger'], + os: '!win32' + } }, // The actual test we wish to run diff --git a/test/functional/mongo_client.test.js b/test/functional/mongo_client.test.js index 3943a04bcb8..a2081144d21 100644 --- a/test/functional/mongo_client.test.js +++ b/test/functional/mongo_client.test.js @@ -487,7 +487,7 @@ describe('MongoClient', function() { }); it('should correctly connect to mongodb using domain socket', { - metadata: { requires: { topology: ['single'] } }, + metadata: { requires: { topology: ['single'], os: '!win32' } }, // The actual test we wish to run test: function(done) { diff --git a/test/mocha.opts b/test/mocha.opts index cf335621394..7f44530476a 100644 --- a/test/mocha.opts +++ b/test/mocha.opts @@ -3,3 +3,4 @@ --file test/tools/runner --ui test/tools/runner/metadata_ui.js --reporter spec-xunit-file + --color diff --git a/test/unit/core/connect.test.js b/test/unit/core/connect.test.js index 2659c7f2a4d..c73016a562e 100644 --- a/test/unit/core/connect.test.js +++ b/test/unit/core/connect.test.js @@ -100,17 +100,20 @@ 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 - - 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(); - }); + it('should allow a cancellaton token', { + metadata: { requires: { os: '!win32' } }, + 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(); + }); + } }); describe('runCommand', function() { From df4560aeaf37a5edd1420931889db2be5152015c Mon Sep 17 00:00:00 2001 From: emadum Date: Sat, 28 Nov 2020 00:49:17 -0500 Subject: [PATCH 02/10] fixes for windows --- .evergreen/config.yml | 274 +++++++++++++++++++++++- .evergreen/config.yml.in | 53 ++--- .evergreen/generate_evergreen_tasks.js | 66 +++--- .evergreen/install-dependencies.sh | 92 +++++++- .evergreen/run-tests.sh | 14 +- test/functional/change_stream.test.js | 3 +- test/functional/cmap/connection.test.js | 27 ++- test/functional/cursor.test.js | 5 +- test/unit/core/connect.test.js | 25 +-- 9 files changed, 458 insertions(+), 101 deletions(-) diff --git a/.evergreen/config.yml b/.evergreen/config.yml index 539e2a0146e..4f720c37605 100644 --- a/.evergreen/config.yml +++ b/.evergreen/config.yml @@ -11,7 +11,6 @@ functions: - command: git.get_project params: directory: src - - command: git.apply_patch - command: shell.exec params: working_dir: src @@ -29,6 +28,14 @@ functions: 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 +67,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 git://github.com/mongodb-labs/drivers-evergreen-tools.git $DRIVERS_TOOLS echo "{ \"releases\": { \"default\": \"$MONGODB_BINARIES\" }}" > $MONGO_ORCHESTRATION_HOME/orchestration.config @@ -113,7 +113,7 @@ functions: fi AUTH=${AUTH} SSL=${SSL} UNIFIED=${UNIFIED} MONGODB_URI="${MONGODB_URI}" \ - bash ${PROJECT_DIRECTORY}/.evergreen/run-tests.sh + NODE_VERSION=${NODE_VERSION} bash ${PROJECT_DIRECTORY}/.evergreen/run-tests.sh run checks: - command: shell.exec type: test @@ -136,6 +136,17 @@ functions: 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 make files executable: - command: shell.exec params: @@ -151,7 +162,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 @@ -420,6 +435,7 @@ functions: pre: - func: fetch source - func: prepare resources + - func: windows fix - func: fix absolute paths - func: make files executable post: @@ -430,6 +446,7 @@ tasks: tags: - latest - server + - full-suite commands: - func: install dependencies - func: bootstrap mongo-orchestration @@ -441,6 +458,7 @@ tasks: tags: - latest - replica_set + - full-suite commands: - func: install dependencies - func: bootstrap mongo-orchestration @@ -452,6 +470,7 @@ tasks: tags: - latest - sharded_cluster + - full-suite commands: - func: install dependencies - func: bootstrap mongo-orchestration @@ -463,6 +482,7 @@ tasks: tags: - latest - server-unified + - full-suite commands: - func: install dependencies - func: bootstrap mongo-orchestration @@ -476,6 +496,7 @@ tasks: tags: - latest - replica_set-unified + - full-suite commands: - func: install dependencies - func: bootstrap mongo-orchestration @@ -489,6 +510,7 @@ tasks: tags: - latest - sharded_cluster-unified + - full-suite commands: - func: install dependencies - func: bootstrap mongo-orchestration @@ -502,6 +524,7 @@ tasks: tags: - '4.4' - server + - full-suite commands: - func: install dependencies - func: bootstrap mongo-orchestration @@ -513,6 +536,7 @@ tasks: tags: - '4.4' - replica_set + - full-suite commands: - func: install dependencies - func: bootstrap mongo-orchestration @@ -524,6 +548,7 @@ tasks: tags: - '4.4' - sharded_cluster + - full-suite commands: - func: install dependencies - func: bootstrap mongo-orchestration @@ -535,6 +560,7 @@ tasks: tags: - '4.4' - server-unified + - full-suite commands: - func: install dependencies - func: bootstrap mongo-orchestration @@ -548,6 +574,7 @@ tasks: tags: - '4.4' - replica_set-unified + - full-suite commands: - func: install dependencies - func: bootstrap mongo-orchestration @@ -561,6 +588,7 @@ tasks: tags: - '4.4' - sharded_cluster-unified + - full-suite commands: - func: install dependencies - func: bootstrap mongo-orchestration @@ -574,6 +602,7 @@ tasks: tags: - '4.2' - server + - full-suite commands: - func: install dependencies - func: bootstrap mongo-orchestration @@ -585,6 +614,7 @@ tasks: tags: - '4.2' - replica_set + - full-suite commands: - func: install dependencies - func: bootstrap mongo-orchestration @@ -596,6 +626,7 @@ tasks: tags: - '4.2' - sharded_cluster + - full-suite commands: - func: install dependencies - func: bootstrap mongo-orchestration @@ -607,6 +638,7 @@ tasks: tags: - '4.2' - server-unified + - full-suite commands: - func: install dependencies - func: bootstrap mongo-orchestration @@ -620,6 +652,7 @@ tasks: tags: - '4.2' - replica_set-unified + - full-suite commands: - func: install dependencies - func: bootstrap mongo-orchestration @@ -633,6 +666,7 @@ tasks: tags: - '4.2' - sharded_cluster-unified + - full-suite commands: - func: install dependencies - func: bootstrap mongo-orchestration @@ -646,6 +680,7 @@ tasks: tags: - '4.0' - server + - full-suite commands: - func: install dependencies - func: bootstrap mongo-orchestration @@ -657,6 +692,7 @@ tasks: tags: - '4.0' - replica_set + - full-suite commands: - func: install dependencies - func: bootstrap mongo-orchestration @@ -668,6 +704,7 @@ tasks: tags: - '4.0' - sharded_cluster + - full-suite commands: - func: install dependencies - func: bootstrap mongo-orchestration @@ -679,6 +716,7 @@ tasks: tags: - '4.0' - server-unified + - full-suite commands: - func: install dependencies - func: bootstrap mongo-orchestration @@ -692,6 +730,7 @@ tasks: tags: - '4.0' - replica_set-unified + - full-suite commands: - func: install dependencies - func: bootstrap mongo-orchestration @@ -705,6 +744,7 @@ tasks: tags: - '4.0' - sharded_cluster-unified + - full-suite commands: - func: install dependencies - func: bootstrap mongo-orchestration @@ -718,6 +758,7 @@ tasks: tags: - '3.6' - server + - full-suite commands: - func: install dependencies - func: bootstrap mongo-orchestration @@ -729,6 +770,7 @@ tasks: tags: - '3.6' - replica_set + - full-suite commands: - func: install dependencies - func: bootstrap mongo-orchestration @@ -740,6 +782,7 @@ tasks: tags: - '3.6' - sharded_cluster + - full-suite commands: - func: install dependencies - func: bootstrap mongo-orchestration @@ -751,6 +794,7 @@ tasks: tags: - '3.6' - server-unified + - full-suite commands: - func: install dependencies - func: bootstrap mongo-orchestration @@ -764,6 +808,7 @@ tasks: tags: - '3.6' - replica_set-unified + - full-suite commands: - func: install dependencies - func: bootstrap mongo-orchestration @@ -777,6 +822,7 @@ tasks: tags: - '3.6' - sharded_cluster-unified + - full-suite commands: - func: install dependencies - func: bootstrap mongo-orchestration @@ -790,6 +836,7 @@ tasks: tags: - '3.4' - server + - full-suite commands: - func: install dependencies - func: bootstrap mongo-orchestration @@ -801,6 +848,7 @@ tasks: tags: - '3.4' - replica_set + - full-suite commands: - func: install dependencies - func: bootstrap mongo-orchestration @@ -812,6 +860,7 @@ tasks: tags: - '3.4' - sharded_cluster + - full-suite commands: - func: install dependencies - func: bootstrap mongo-orchestration @@ -823,6 +872,7 @@ tasks: tags: - '3.4' - server-unified + - full-suite commands: - func: install dependencies - func: bootstrap mongo-orchestration @@ -836,6 +886,7 @@ tasks: tags: - '3.4' - replica_set-unified + - full-suite commands: - func: install dependencies - func: bootstrap mongo-orchestration @@ -849,6 +900,7 @@ tasks: tags: - '3.4' - sharded_cluster-unified + - full-suite commands: - func: install dependencies - func: bootstrap mongo-orchestration @@ -862,6 +914,7 @@ tasks: tags: - '3.2' - server + - full-suite commands: - func: install dependencies - func: bootstrap mongo-orchestration @@ -873,6 +926,7 @@ tasks: tags: - '3.2' - replica_set + - full-suite commands: - func: install dependencies - func: bootstrap mongo-orchestration @@ -884,6 +938,7 @@ tasks: tags: - '3.2' - sharded_cluster + - full-suite commands: - func: install dependencies - func: bootstrap mongo-orchestration @@ -895,6 +950,7 @@ tasks: tags: - '3.2' - server-unified + - full-suite commands: - func: install dependencies - func: bootstrap mongo-orchestration @@ -908,6 +964,7 @@ tasks: tags: - '3.2' - replica_set-unified + - full-suite commands: - func: install dependencies - func: bootstrap mongo-orchestration @@ -921,6 +978,7 @@ tasks: tags: - '3.2' - sharded_cluster-unified + - full-suite commands: - func: install dependencies - func: bootstrap mongo-orchestration @@ -934,6 +992,7 @@ tasks: tags: - '3.0' - server + - full-suite commands: - func: install dependencies - func: bootstrap mongo-orchestration @@ -945,6 +1004,7 @@ tasks: tags: - '3.0' - replica_set + - full-suite commands: - func: install dependencies - func: bootstrap mongo-orchestration @@ -956,6 +1016,7 @@ tasks: tags: - '3.0' - sharded_cluster + - full-suite commands: - func: install dependencies - func: bootstrap mongo-orchestration @@ -967,6 +1028,7 @@ tasks: tags: - '3.0' - server-unified + - full-suite commands: - func: install dependencies - func: bootstrap mongo-orchestration @@ -980,6 +1042,7 @@ tasks: tags: - '3.0' - replica_set-unified + - full-suite commands: - func: install dependencies - func: bootstrap mongo-orchestration @@ -993,6 +1056,7 @@ tasks: tags: - '3.0' - sharded_cluster-unified + - full-suite commands: - func: install dependencies - func: bootstrap mongo-orchestration @@ -1006,6 +1070,7 @@ tasks: tags: - '2.6' - server + - full-suite commands: - func: install dependencies - func: bootstrap mongo-orchestration @@ -1017,6 +1082,7 @@ tasks: tags: - '2.6' - replica_set + - full-suite commands: - func: install dependencies - func: bootstrap mongo-orchestration @@ -1028,6 +1094,7 @@ tasks: tags: - '2.6' - sharded_cluster + - full-suite commands: - func: install dependencies - func: bootstrap mongo-orchestration @@ -1039,6 +1106,7 @@ tasks: tags: - '2.6' - server-unified + - full-suite commands: - func: install dependencies - func: bootstrap mongo-orchestration @@ -1052,6 +1120,7 @@ tasks: tags: - '2.6' - replica_set-unified + - full-suite commands: - func: install dependencies - func: bootstrap mongo-orchestration @@ -1065,6 +1134,7 @@ tasks: tags: - '2.6' - sharded_cluster-unified + - full-suite commands: - func: install dependencies - func: bootstrap mongo-orchestration @@ -1650,6 +1720,188 @@ buildvariants: NODE_LTS_NAME: argon CLIENT_ENCRYPTION: true tasks: *ref_2 + - name: windows-64-vs2010-erbium + display_name: Windows (VS2010) Node Erbium + run_on: windows-64-vs2010-large + expansions: + NODE_LTS_NAME: erbium + MSVS_VERSION: 2010 + tasks: &ref_3 + - test-4.2-server + - test-4.2-replica_set + - test-4.2-sharded_cluster + - test-4.2-server-unified + - test-4.2-replica_set-unified + - test-4.2-sharded_cluster-unified + - test-4.0-server + - test-4.0-replica_set + - test-4.0-sharded_cluster + - test-4.0-server-unified + - test-4.0-replica_set-unified + - test-4.0-sharded_cluster-unified + - test-3.6-server + - test-3.6-replica_set + - test-3.6-sharded_cluster + - test-3.6-server-unified + - test-3.6-replica_set-unified + - test-3.6-sharded_cluster-unified + - test-3.4-server + - test-3.4-replica_set + - test-3.4-sharded_cluster + - test-3.4-server-unified + - test-3.4-replica_set-unified + - test-3.4-sharded_cluster-unified + - test-3.2-server + - test-3.2-replica_set + - test-3.2-sharded_cluster + - test-3.2-server-unified + - test-3.2-replica_set-unified + - test-3.2-sharded_cluster-unified + - test-3.0-server + - test-3.0-replica_set + - test-3.0-sharded_cluster + - test-3.0-server-unified + - test-3.0-replica_set-unified + - test-3.0-sharded_cluster-unified + - test-2.6-server + - test-2.6-replica_set + - test-2.6-sharded_cluster + - test-2.6-server-unified + - test-2.6-replica_set-unified + - test-2.6-sharded_cluster-unified + - name: windows-64-vs2010-dubnium + display_name: Windows (VS2010) Node Dubnium + run_on: windows-64-vs2010-large + expansions: + NODE_LTS_NAME: dubnium + MSVS_VERSION: 2010 + tasks: *ref_3 + - name: windows-64-vs2010-carbon + display_name: Windows (VS2010) Node Carbon + run_on: windows-64-vs2010-large + expansions: + NODE_LTS_NAME: carbon + MSVS_VERSION: 2010 + tasks: *ref_3 + - name: windows-64-vs2010-boron + display_name: Windows (VS2010) Node Boron + run_on: windows-64-vs2010-large + expansions: + NODE_LTS_NAME: boron + MSVS_VERSION: 2010 + tasks: *ref_3 + - name: windows-64-vs2010-argon + display_name: Windows (VS2010) Node Argon + run_on: windows-64-vs2010-large + expansions: + NODE_LTS_NAME: argon + MSVS_VERSION: 2010 + tasks: *ref_3 + - name: windows-64-vs2013-erbium + display_name: Windows (VS2013) Node Erbium + run_on: windows-64-vs2013-large + expansions: + NODE_LTS_NAME: erbium + MSVS_VERSION: 2013 + tasks: *ref_3 + - name: windows-64-vs2013-dubnium + display_name: Windows (VS2013) Node Dubnium + run_on: windows-64-vs2013-large + expansions: + NODE_LTS_NAME: dubnium + MSVS_VERSION: 2013 + tasks: *ref_3 + - name: windows-64-vs2013-carbon + display_name: Windows (VS2013) Node Carbon + run_on: windows-64-vs2013-large + expansions: + NODE_LTS_NAME: carbon + MSVS_VERSION: 2013 + tasks: *ref_3 + - name: windows-64-vs2013-boron + display_name: Windows (VS2013) Node Boron + run_on: windows-64-vs2013-large + expansions: + NODE_LTS_NAME: boron + MSVS_VERSION: 2013 + tasks: *ref_3 + - name: windows-64-vs2013-argon + display_name: Windows (VS2013) Node Argon + run_on: windows-64-vs2013-large + expansions: + NODE_LTS_NAME: argon + MSVS_VERSION: 2013 + tasks: *ref_3 + - 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-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 + - name: windows-64-vs2015-carbon + display_name: Windows (VS2015) Node Carbon + run_on: windows-64-vs2015-large + expansions: + NODE_LTS_NAME: carbon + MSVS_VERSION: 2015 + tasks: *ref_3 + - name: windows-64-vs2015-boron + display_name: Windows (VS2015) Node Boron + run_on: windows-64-vs2015-large + expansions: + NODE_LTS_NAME: boron + MSVS_VERSION: 2015 + tasks: *ref_3 + - name: windows-64-vs2015-argon + display_name: Windows (VS2015) Node Argon + run_on: windows-64-vs2015-large + expansions: + NODE_LTS_NAME: argon + MSVS_VERSION: 2015 + 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: 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-carbon + display_name: Windows (VS2017) Node Carbon + run_on: windows-64-vs2017-large + expansions: + NODE_LTS_NAME: carbon + MSVS_VERSION: 2017 + tasks: *ref_3 + - name: windows-64-vs2017-boron + display_name: Windows (VS2017) Node Boron + run_on: windows-64-vs2017-large + expansions: + NODE_LTS_NAME: boron + MSVS_VERSION: 2017 + tasks: *ref_3 + - name: windows-64-vs2017-argon + display_name: Windows (VS2017) Node Argon + run_on: windows-64-vs2017-large + expansions: + NODE_LTS_NAME: argon + 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 fcd0f98d224..ed8c4a28a99 100644 --- a/.evergreen/config.yml.in +++ b/.evergreen/config.yml.in @@ -26,10 +26,7 @@ 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 + # Make an evergreen expansion file with dynamic values - command: shell.exec params: working_dir: "src" @@ -47,6 +44,14 @@ functions: 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 +85,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 git://github.com/mongodb-labs/drivers-evergreen-tools.git $DRIVERS_TOOLS echo "{ \"releases\": { \"default\": \"$MONGODB_BINARIES\" }}" > $MONGO_ORCHESTRATION_HOME/orchestration.config "bootstrap mongo-orchestration": @@ -133,7 +132,7 @@ functions: fi AUTH=${AUTH} SSL=${SSL} UNIFIED=${UNIFIED} MONGODB_URI="${MONGODB_URI}" \ - bash ${PROJECT_DIRECTORY}/.evergreen/run-tests.sh + NODE_VERSION=${NODE_VERSION} bash ${PROJECT_DIRECTORY}/.evergreen/run-tests.sh "run checks": - command: shell.exec @@ -160,17 +159,17 @@ functions: 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: + 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 @@ -188,7 +187,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 @@ -472,7 +475,7 @@ functions: pre: - func: "fetch source" - func: "prepare resources" - # - func: "windows fix" + - func: "windows fix" - func: "fix absolute paths" - func: "make files executable" diff --git a/.evergreen/generate_evergreen_tasks.js b/.evergreen/generate_evergreen_tasks.js index 763086e1236..bc33d92a9c5 100644 --- a/.evergreen/generate_evergreen_tasks.js +++ b/.evergreen/generate_evergreen_tasks.js @@ -39,24 +39,35 @@ const OPERATING_SYSTEMS = [ run_on: 'ubuntu1804-test', mongoVersion: '>=3.2', clientEncryption: true + }, + { + name: 'windows-64-vs2010', + display_name: 'Windows (VS2010)', + run_on: 'windows-64-vs2010-large', + msvsVersion: 2010, + mongoVersion: '<4.4' + }, + { + name: 'windows-64-vs2013', + display_name: 'Windows (VS2013)', + run_on: 'windows-64-vs2013-large', + msvsVersion: 2013, + mongoVersion: '<4.4' + }, + { + 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' } - - // 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' - // } ].map(osConfig => Object.assign( { @@ -71,8 +82,10 @@ const OPERATING_SYSTEMS = [ const TASKS = []; const SINGLETON_TASKS = []; -function makeTask({ mongoVersion, topology }) { +function makeTask({ mongoVersion, topology, tags }) { let topologyForTest = topology; + if (!tags) tags = []; + tags.unshift(mongoVersion, topology); let runTestsCommand = { func: 'run tests' }; if (topology.indexOf('-unified') !== -1) { topologyForTest = topology.split('-unified')[0]; @@ -81,7 +94,7 @@ function makeTask({ mongoVersion, topology }) { return { name: `test-${mongoVersion}-${topology}`, - tags: [mongoVersion, topology], + tags, commands: [ { func: 'install dependencies' }, { @@ -98,7 +111,7 @@ function makeTask({ mongoVersion, topology }) { MONGODB_VERSIONS.forEach(mongoVersion => { TOPOLOGIES.forEach(topology => - TASKS.push(makeTask({ mongoVersion, topology })) + TASKS.push(makeTask({ mongoVersion, topology, tags: ['full-suite'] })) ); }); @@ -312,14 +325,15 @@ const BUILD_VARIANTS = []; const getTaskList = (() => { const memo = {}; - return function(mongoVersion) { - const key = mongoVersion; + return function(mongoVersion, onlyFullSuite = false) { + const key = mongoVersion + (onlyFullSuite ? 'F' : ''); if (memo[key]) { return memo[key]; } const ret = TASKS.filter(task => { + if (onlyFullSuite && (!task.tags || !task.tags.includes('full-suite'))) return false; const tasksWithVars = task.commands.filter(task => !!task.vars); if (task.name.match(/^aws/)) return false; @@ -352,10 +366,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)}`; @@ -366,6 +381,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 }); }); diff --git a/.evergreen/install-dependencies.sh b/.evergreen/install-dependencies.sh index e856ee76f48..e48aebf7045 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,13 +20,79 @@ 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} +node_lts_version () { + case $1 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 -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} +} + +node_lts_version $NODE_LTS_NAME +echo "NODE_VERSION=$NODE_VERSION" +# 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 + echo "--- Installing nvm on Windows ---" + # 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 -# setup npm cache in a local directory -cat < .npmrc + 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 + npm config set msvs_version ${MSVS_VERSION} + echo "Windows install done (MSVS_VERSION=${MSVS_VERSION})" + +# install Node.js on Linux/MacOS +else + echo "--- Installing nvm on Linux/MacOS ---" + curl -o- $NVM_URL | bash + [ -s "${NVM_DIR}/nvm.sh" ] && \. "${NVM_DIR}/nvm.sh" + nvm install --no-progress --lts=${NODE_LTS_NAME} + + # 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} @@ -30,8 +100,16 @@ tmp=${NPM_TMP_DIR} registry=https://registry.npmjs.org EOT + echo "Linux/MacOS install done" +fi + # NOTE: registry was overridden to not use artifactory, remove the `registry` line when # BUILD-6774 is resolved. # install node dependencies -npm install +if [[ "$SKIP_INSTALL" == "1" ]]; then + echo "Skipping npm install" +else + echo "Running npm install" + npm install --unsafe-perm +fi diff --git a/.evergreen/run-tests.sh b/.evergreen/run-tests.sh index d8c4eccc57e..492a415939d 100755 --- a/.evergreen/run-tests.sh +++ b/.evergreen/run-tests.sh @@ -12,6 +12,7 @@ set -o errexit # Exit the script with error if any of the commands fail AUTH=${AUTH:-noauth} UNIFIED=${UNIFIED:-} MONGODB_URI=${MONGODB_URI:-} +TEST_NPM_SCRIPT="test-nolint" # ssl setup SSL=${SSL:-nossl} @@ -26,7 +27,16 @@ 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 [[ "$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" # only run FLE tets on hosts we explicitly choose to test on if [[ -z "${CLIENT_ENCRYPTION}" ]]; then @@ -36,4 +46,4 @@ else npm install mongodb-client-encryption fi -MONGODB_UNIFIED_TOPOLOGY=${UNIFIED} MONGODB_URI=${MONGODB_URI} npm run test-nolint +MONGODB_UNIFIED_TOPOLOGY=${UNIFIED} MONGODB_URI=${MONGODB_URI} npm run ${TEST_NPM_SCRIPT} diff --git a/test/functional/change_stream.test.js b/test/functional/change_stream.test.js index 5ce79962563..5b92495e793 100644 --- a/test/functional/change_stream.test.js +++ b/test/functional/change_stream.test.js @@ -1480,7 +1480,8 @@ describe('Change Streams', function() { requires: { generators: true, topology: 'single', - mongodb: '>=3.6' + mongodb: '>=3.6', + os: '!win32' } }, test: function(done) { diff --git a/test/functional/cmap/connection.test.js b/test/functional/cmap/connection.test.js index 8b51ed22e12..c52118eaaa8 100644 --- a/test/functional/cmap/connection.test.js +++ b/test/functional/cmap/connection.test.js @@ -61,22 +61,19 @@ describe('Connection', function() { }); }); - it('should support socket timeouts', { - metadata: { requires: { os: '!win32' } }, - test: function(done) { - const connectOptions = Object.assign({ - host: '240.0.0.1', - connectionType: Connection, - bson: new BSON(), - connectionTimeout: 500 - }); + it('should support socket timeouts', function(done) { + const connectOptions = Object.assign({ + host: '240.0.0.1', + connectionType: Connection, + bson: new BSON(), + 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|connect ENETUNREACH)/); + done(); + }); }); it('should support calling back multiple times on exhaust commands', { diff --git a/test/functional/cursor.test.js b/test/functional/cursor.test.js index 2d51fc6d784..069493038be 100644 --- a/test/functional/cursor.test.js +++ b/test/functional/cursor.test.js @@ -2,6 +2,7 @@ const test = require('./shared').assert; const setupDatabase = require('./shared').setupDatabase; const fs = require('fs'); +const os = require('os'); const expect = require('chai').expect; const Long = require('bson').Long; const sinon = require('sinon'); @@ -2242,8 +2243,8 @@ describe('Cursor', function() { collection.insert(docs, configuration.writeConcernMax(), function(err) { test.equal(null, err); - var filename = '/tmp/_nodemongodbnative_stream_out.txt', - out = fs.createWriteStream(filename); + const filename = `${os.tmpdir()}/_nodemongodbnative_stream_out.txt`; + const out = fs.createWriteStream(filename); // hack so we don't need to create a stream filter just to // stringify the objects (otherwise the created file would diff --git a/test/unit/core/connect.test.js b/test/unit/core/connect.test.js index c73016a562e..5e5985e2a3c 100644 --- a/test/unit/core/connect.test.js +++ b/test/unit/core/connect.test.js @@ -100,20 +100,17 @@ describe('Connect Tests', function() { }); }); - it('should allow a cancellaton token', { - metadata: { requires: { os: '!win32' } }, - 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(); - }); - } + 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 + + connect({ host: '240.0.0.1' }, cancellationToken, (err, conn) => { + expect(err).to.exist; + expect(err).to.match(/(connection establishment was cancelled|connect ENETUNREACH)/); + expect(conn).to.not.exist; + done(); + }); }); describe('runCommand', function() { From 1294ba969a4dc3837d497142429c8bc518ccbe2c Mon Sep 17 00:00:00 2001 From: emadum Date: Sat, 28 Nov 2020 10:35:10 -0500 Subject: [PATCH 03/10] fix: transition topology state before async calls --- lib/core/topologies/replset.js | 17 +++++---- lib/core/topologies/server.js | 5 +-- .../core/rs_mocks/connection.test.js | 36 +++++++------------ 3 files changed, 26 insertions(+), 32 deletions(-) diff --git a/lib/core/topologies/replset.js b/lib/core/topologies/replset.js index deaa60fa7a2..0be880f998a 100644 --- a/lib/core/topologies/replset.js +++ b/lib/core/topologies/replset.js @@ -541,7 +541,7 @@ var monitorServer = function(host, self, options) { self.s.options.secondaryOnlyConnectionAllowed) || self.s.replicaSetState.hasPrimary()) ) { - self.state = CONNECTED; + stateTransition(self, CONNECTED); // Emit connected sign process.nextTick(function() { @@ -558,7 +558,7 @@ var monitorServer = function(host, self, options) { self.s.options.secondaryOnlyConnectionAllowed) || self.s.replicaSetState.hasPrimary()) ) { - self.state = CONNECTED; + stateTransition(self, CONNECTED); // Rexecute any stalled operation rexecuteOperations(self); @@ -787,7 +787,7 @@ function handleInitialConnectEvent(self, event) { // Do we have a primary or primaryAndSecondary if (shouldTriggerConnect(self)) { // We are connected - self.state = CONNECTED; + stateTransition(self, CONNECTED); // Set initial connect state self.initialConnectState.connect = true; @@ -975,14 +975,19 @@ ReplSet.prototype.destroy = function(options, callback) { // Emit toplogy closing event emitSDAMEvent(this, 'topologyClosed', { topologyId: this.id }); - // Transition state - stateTransition(this, DESTROYED); - if (typeof callback === 'function') { callback(null, null); } }; + if (this.state === DESTROYED) { + if (typeof callback === 'function') callback(null, null); + return; + } + + // Transition state + stateTransition(this, DESTROYED); + // Clear out any monitoring process if (this.haTimeoutId) clearTimeout(this.haTimeoutId); diff --git a/lib/core/topologies/server.js b/lib/core/topologies/server.js index ecf46135cae..c6a0bfa5db9 100644 --- a/lib/core/topologies/server.js +++ b/lib/core/topologies/server.js @@ -864,12 +864,14 @@ Server.prototype.destroy = function(options, callback) { } // No pool, return - if (!self.s.pool) { + if (!self.s.pool || this._destroyed) { this._destroyed = true; if (typeof callback === 'function') callback(null, null); return; } + this._destroyed = true; + // Emit close event if (options.emitClose) { self.emit('close', self); @@ -900,7 +902,6 @@ Server.prototype.destroy = function(options, callback) { // Destroy the pool this.s.pool.destroy(options.force, callback); - this._destroyed = true; }; /** diff --git a/test/functional/core/rs_mocks/connection.test.js b/test/functional/core/rs_mocks/connection.test.js index 15f4e3e1201..31cb957593e 100644 --- a/test/functional/core/rs_mocks/connection.test.js +++ b/test/functional/core/rs_mocks/connection.test.js @@ -135,8 +135,7 @@ describe('ReplSet Connection Tests (mocks)', function() { expect(server.s.replicaSetState.primary).to.not.be.null; expect(server.s.replicaSetState.primary.name).to.equal('localhost:32000'); - server.destroy(); - done(); + server.destroy(done); } } }); @@ -251,8 +250,7 @@ describe('ReplSet Connection Tests (mocks)', function() { expect(server.s.replicaSetState.primary).to.not.be.null; expect(server.s.replicaSetState.primary.name).to.equal('localhost:32000'); - server.destroy(); - done(); + server.destroy(done); } } }); @@ -352,8 +350,7 @@ describe('ReplSet Connection Tests (mocks)', function() { expect(server.s.replicaSetState.primary).to.not.be.null; expect(server.s.replicaSetState.primary.name).to.equal('localhost:32000'); - server.destroy(); - done(); + server.destroy(done); } // Joined @@ -430,8 +427,7 @@ describe('ReplSet Connection Tests (mocks)', function() { ); server.on('error', function() { - server.destroy(); - done(); + server.destroy(done); }); server.connect(); @@ -530,8 +526,7 @@ describe('ReplSet Connection Tests (mocks)', function() { expect(server.s.replicaSetState.primary).to.be.null; - server.destroy(); - done(); + server.destroy(done); } }); @@ -654,8 +649,7 @@ describe('ReplSet Connection Tests (mocks)', function() { expect(server.s.replicaSetState.primary).to.not.be.null; expect(server.s.replicaSetState.primary.name).to.equal('localhost:32000'); - server.destroy(); - done(); + server.destroy(done); } } }); @@ -761,8 +755,7 @@ describe('ReplSet Connection Tests (mocks)', function() { ); server.on('error', function() { - server.destroy(); - done(); + server.destroy(done); }); // Gives proxies a chance to boot up @@ -859,8 +852,7 @@ describe('ReplSet Connection Tests (mocks)', function() { expect(server.s.replicaSetState.primary).to.not.be.null; expect(server.s.replicaSetState.primary.name).to.equal('localhost:32000'); - server.destroy(); - done(); + server.destroy(done); } } }); @@ -981,8 +973,7 @@ describe('ReplSet Connection Tests (mocks)', function() { expect(server.s.replicaSetState.primary).to.not.be.null; expect(server.s.replicaSetState.primary.name).to.equal('localhost:32000'); - server.destroy(); - done(); + server.destroy(done); } } }); @@ -1072,8 +1063,7 @@ describe('ReplSet Connection Tests (mocks)', function() { expect(server.s.replicaSetState.primary).to.not.be.null; expect(server.s.replicaSetState.primary.name).to.equal('localhost:32000'); - server.destroy(); - done(); + server.destroy(done); } } }); @@ -1184,8 +1174,7 @@ describe('ReplSet Connection Tests (mocks)', function() { expect(server.__connected).to.be.true; expect(server.__fullsetup).to.be.true; - server.destroy(); - done(); + server.destroy(done); }); server.connect(); @@ -1276,8 +1265,7 @@ describe('ReplSet Connection Tests (mocks)', function() { var result = server.lastIsMaster(); expect(result).to.exist; - server.destroy(); - done(); + server.destroy(done); }); server.connect(); From 108bf8244892a8d51037d2b1abe0e48161db77d9 Mon Sep 17 00:00:00 2001 From: emadum Date: Sat, 28 Nov 2020 16:46:13 -0500 Subject: [PATCH 04/10] more fixes --- .evergreen/config.yml | 6 ++ .evergreen/config.yml.in | 27 +++++---- .evergreen/install-dependencies.sh | 67 +++++++++++------------ test/functional/change_stream.test.js | 10 ++-- test/functional/cursor.test.js | 7 ++- test/functional/operation_example.test.js | 2 +- 6 files changed, 65 insertions(+), 54 deletions(-) diff --git a/.evergreen/config.yml b/.evergreen/config.yml index 4f720c37605..979e9d9de2e 100644 --- a/.evergreen/config.yml +++ b/.evergreen/config.yml @@ -125,12 +125,14 @@ 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 @@ -139,6 +141,7 @@ functions: windows fix: - command: shell.exec params: + silent: true script: | ${PREPARE_SHELL} # for i in $(find ${DRIVERS_TOOLS}/.evergreen ${PROJECT_DIRECTORY}/.evergreen -name \*.sh); do @@ -150,6 +153,7 @@ functions: 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 @@ -441,6 +445,8 @@ pre: post: - func: upload test results - func: cleanup +ignore: + - '*.md' tasks: - name: test-latest-server tags: diff --git a/.evergreen/config.yml.in b/.evergreen/config.yml.in index ed8c4a28a99..82d06c7432f 100644 --- a/.evergreen/config.yml.in +++ b/.evergreen/config.yml.in @@ -146,6 +146,7 @@ functions: "cleanup": - command: shell.exec params: + silent: true script: | ${PREPARE_SHELL} rm -rf $DRIVERS_TOOLS || true @@ -153,6 +154,7 @@ functions: "fix absolute paths": - command: shell.exec params: + silent: true script: | ${PREPARE_SHELL} for filename in $(find ${DRIVERS_TOOLS} -name \*.json); do @@ -162,6 +164,7 @@ functions: "windows fix": - command: shell.exec params: + silent: true script: | ${PREPARE_SHELL} # for i in $(find ${DRIVERS_TOOLS}/.evergreen ${PROJECT_DIRECTORY}/.evergreen -name \*.sh); do @@ -174,6 +177,7 @@ functions: "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 @@ -270,7 +274,7 @@ functions: } EOF - run aws auth test with regular aws credentials: + "run aws auth test with regular aws credentials": - command: shell.exec type: test params: @@ -299,7 +303,7 @@ functions: ${PREPARE_SHELL} ${PROJECT_DIRECTORY}/.evergreen/run-mongodb-aws-test.sh - run aws auth test with assume role credentials: + "run aws auth test with assume role credentials": - command: shell.exec type: test params: @@ -332,7 +336,7 @@ functions: ${PREPARE_SHELL} ${PROJECT_DIRECTORY}/.evergreen/run-mongodb-aws-test.sh - run aws auth test with aws EC2 credentials: + "run aws auth test with aws EC2 credentials": - command: shell.exec type: test params: @@ -349,7 +353,7 @@ functions: ${PREPARE_SHELL} ${PROJECT_DIRECTORY}/.evergreen/run-mongodb-aws-test.sh - run aws auth test with aws credentials as environment variables: + "run aws auth test with aws credentials as environment variables": - command: shell.exec type: test params: @@ -369,7 +373,7 @@ functions: ${PREPARE_SHELL} ${PROJECT_DIRECTORY}/.evergreen/run-mongodb-aws-test.sh - run aws auth test with aws credentials and session token as environment variables: + "run aws auth test with aws credentials and session token as environment variables": - command: shell.exec type: test params: @@ -390,7 +394,7 @@ functions: ${PREPARE_SHELL} ${PROJECT_DIRECTORY}/.evergreen/run-mongodb-aws-test.sh - run aws ECS auth test: + "run aws ECS auth test": - command: shell.exec type: test params: @@ -417,7 +421,7 @@ functions: cat setup.js mongo --nodb setup.js aws_e2e_ecs.js - run-ocsp-test: + "run-ocsp-test": - command: shell.exec type: test params: @@ -430,7 +434,7 @@ functions: OCSP_TLS_SHOULD_SUCCEED="${OCSP_TLS_SHOULD_SUCCEED}" \ bash ${PROJECT_DIRECTORY}/.evergreen/run-ocsp-tests.sh - run-valid-ocsp-server: + "run-valid-ocsp-server": - command: shell.exec params: script: | @@ -448,7 +452,7 @@ functions: --ocsp_responder_key rsa/ca.key \ -p 8100 -v - run-revoked-ocsp-server: + "run-revoked-ocsp-server": - command: shell.exec params: script: | @@ -468,7 +472,7 @@ functions: -v \ --fault revoked - upload test results: + "upload test results": - command: attach.xunit_results params: file: src/xunit.xml @@ -482,3 +486,6 @@ pre: post: - func: "upload test results" - func: "cleanup" + +ignore: + - '*.md' diff --git a/.evergreen/install-dependencies.sh b/.evergreen/install-dependencies.sh index e48aebf7045..be0cbd7b01a 100644 --- a/.evergreen/install-dependencies.sh +++ b/.evergreen/install-dependencies.sh @@ -20,38 +20,35 @@ mkdir -p ${NODE_ARTIFACTS_PATH} mkdir -p ${NPM_CACHE_DIR} mkdir -p "${NPM_TMP_DIR}" -node_lts_version () { - case $1 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 -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} -} +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} -node_lts_version $NODE_LTS_NAME -echo "NODE_VERSION=$NODE_VERSION" # output node version to expansions file for use in subsequent scripts cat < deps-expansion.yml NODE_VERSION: "$NODE_VERSION" @@ -59,7 +56,6 @@ EOT # install Node.js on Windows if [[ "$OS" == "Windows_NT" ]]; then - echo "--- Installing nvm on Windows ---" # Delete pre-existing node to avoid version conflicts rm -rf "/cygdrive/c/Program Files/nodejs" @@ -81,12 +77,13 @@ path: $NVM_SYMLINK EOT nvm install $NODE_VERSION nvm use $NODE_VERSION + which node + which npm npm config set msvs_version ${MSVS_VERSION} - echo "Windows install done (MSVS_VERSION=${MSVS_VERSION})" + npm config set scripts-prepend-node-path true # install Node.js on Linux/MacOS else - echo "--- Installing nvm on Linux/MacOS ---" curl -o- $NVM_URL | bash [ -s "${NVM_DIR}/nvm.sh" ] && \. "${NVM_DIR}/nvm.sh" nvm install --no-progress --lts=${NODE_LTS_NAME} @@ -99,8 +96,6 @@ cache=${NPM_CACHE_DIR} tmp=${NPM_TMP_DIR} registry=https://registry.npmjs.org EOT - - echo "Linux/MacOS install done" fi # NOTE: registry was overridden to not use artifactory, remove the `registry` line when diff --git a/test/functional/change_stream.test.js b/test/functional/change_stream.test.js index 5b92495e793..a5f83366c8d 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 = require('stream').Transform; const MongoNetworkError = require('../../lib/core').MongoNetworkError; @@ -13,6 +12,8 @@ const chai = require('chai'); const expect = chai.expect; const sinon = require('sinon'); const fs = require('fs'); +const os = require('os'); +const path = require('path'); const crypto = require('crypto'); const BSON = require('bson'); const Long = BSON.Long; @@ -1478,14 +1479,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', - os: '!win32' + 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; const ObjectId = configuration.require.ObjectId; @@ -1601,6 +1602,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/cursor.test.js b/test/functional/cursor.test.js index 069493038be..5c5f1738ff9 100644 --- a/test/functional/cursor.test.js +++ b/test/functional/cursor.test.js @@ -3,6 +3,7 @@ const test = require('./shared').assert; const setupDatabase = require('./shared').setupDatabase; const fs = require('fs'); const os = require('os'); +const path = require('path'); const expect = require('chai').expect; const Long = require('bson').Long; const sinon = require('sinon'); @@ -2243,7 +2244,7 @@ describe('Cursor', function() { collection.insert(docs, configuration.writeConcernMax(), function(err) { test.equal(null, err); - const filename = `${os.tmpdir()}/_nodemongodbnative_stream_out.txt`; + const filename = path.join(os.tmpdir(), '_nodemongodbnative_stream_out.txt'); const out = fs.createWriteStream(filename); // hack so we don't need to create a stream filter just to @@ -2286,7 +2287,7 @@ describe('Cursor', function() { /** * @ignore */ - 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: { @@ -2350,7 +2351,7 @@ describe('Cursor', function() { test.equal(null, err); if (id === 99) { - setTimeout(() => client.close()); + setTimeout(() => client.close(validator)); } }); }); diff --git a/test/functional/operation_example.test.js b/test/functional/operation_example.test.js index 599c0f687f4..321140aae90 100644 --- a/test/functional/operation_example.test.js +++ b/test/functional/operation_example.test.js @@ -4105,7 +4105,7 @@ describe('Operation Examples', function() { // Create a capped collection with a maximum of 1000 documents db.createCollection( 'a_simple_collection', - { capped: true, size: 10000, max: 1000, w: 1 }, + { capped: true, size: 1000, max: 1000, w: 1 }, function(err, collection) { test.equal(null, err); From 6ff537581d9c8969b69e3bd49d1d848c3c1520f4 Mon Sep 17 00:00:00 2001 From: emadum Date: Wed, 2 Dec 2020 12:59:22 -0500 Subject: [PATCH 05/10] review feedback --- test/functional/cmap/connection.test.js | 27 ++++++++++--------- test/functional/cursor.test.js | 7 +---- test/functional/operation_example.test.js | 4 +-- test/mocha.opts | 2 +- .../runner/filters/mongodb_topology_filter.js | 2 +- test/unit/core/connect.test.js | 25 +++++++++-------- 6 files changed, 34 insertions(+), 33 deletions(-) diff --git a/test/functional/cmap/connection.test.js b/test/functional/cmap/connection.test.js index c52118eaaa8..cd9b5286ef0 100644 --- a/test/functional/cmap/connection.test.js +++ b/test/functional/cmap/connection.test.js @@ -61,19 +61,22 @@ describe('Connection', function() { }); }); - it('should support socket timeouts', function(done) { - const connectOptions = Object.assign({ - host: '240.0.0.1', - connectionType: Connection, - bson: new BSON(), - connectionTimeout: 500 - }); + it('should support socket timeouts', { + metadata: { requires: { os: '!win32' } }, // 240.0.0.1 doesnt work for windows + test: function(done) { + const connectOptions = Object.assign({ + host: '240.0.0.1', + connectionType: Connection, + bson: new BSON(), + connectionTimeout: 500 + }); - connect(connectOptions, err => { - expect(err).to.exist; - expect(err).to.match(/(timed out|connect ENETUNREACH)/); - 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/cursor.test.js b/test/functional/cursor.test.js index 5c5f1738ff9..765346a5328 100644 --- a/test/functional/cursor.test.js +++ b/test/functional/cursor.test.js @@ -2217,12 +2217,7 @@ describe('Cursor', function() { it('cursor stream pipe', { // 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'], - os: '!win32' - } - }, + metadata: { requires: { os: '!win32' } }, // The actual test we wish to run test: function(done) { diff --git a/test/functional/operation_example.test.js b/test/functional/operation_example.test.js index 321140aae90..14e4010772b 100644 --- a/test/functional/operation_example.test.js +++ b/test/functional/operation_example.test.js @@ -4105,7 +4105,7 @@ describe('Operation Examples', function() { // Create a capped collection with a maximum of 1000 documents db.createCollection( 'a_simple_collection', - { capped: true, size: 1000, max: 1000, w: 1 }, + { capped: true, size: 10000, max: 1000, w: 1 }, function(err, collection) { test.equal(null, err); @@ -9379,7 +9379,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, w: 1 }, + { capped: true, size: 100000, max: 1000, w: 1 }, function(err, collection) { test.equal(null, err); diff --git a/test/mocha.opts b/test/mocha.opts index 7f44530476a..9651c194fea 100644 --- a/test/mocha.opts +++ b/test/mocha.opts @@ -3,4 +3,4 @@ --file test/tools/runner --ui test/tools/runner/metadata_ui.js --reporter spec-xunit-file - --color + --colors diff --git a/test/tools/runner/filters/mongodb_topology_filter.js b/test/tools/runner/filters/mongodb_topology_filter.js index 2725499f92d..76506ae08fd 100755 --- a/test/tools/runner/filters/mongodb_topology_filter.js +++ b/test/tools/runner/filters/mongodb_topology_filter.js @@ -9,7 +9,7 @@ const TopologyType = require('../../../../lib/core/sdam/common').TopologyType; * 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 5e5985e2a3c..e334c0466d0 100644 --- a/test/unit/core/connect.test.js +++ b/test/unit/core/connect.test.js @@ -100,17 +100,20 @@ 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 - - connect({ host: '240.0.0.1' }, cancellationToken, (err, conn) => { - expect(err).to.exist; - expect(err).to.match(/(connection establishment was cancelled|connect ENETUNREACH)/); - expect(conn).to.not.exist; - done(); - }); + it('should allow a cancellaton token', { + metadata: { requires: { os: '!win32' } }, // 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(); + }); + } }); describe('runCommand', function() { From 727aa1614049f2dfac51f0095b527990c95097b0 Mon Sep 17 00:00:00 2001 From: emadum Date: Wed, 2 Dec 2020 13:28:58 -0500 Subject: [PATCH 06/10] remove full-suite tag from evg config --- .evergreen/config.yml | 54 -------------------------- .evergreen/generate_evergreen_tasks.js | 20 +++++----- 2 files changed, 9 insertions(+), 65 deletions(-) diff --git a/.evergreen/config.yml b/.evergreen/config.yml index 979e9d9de2e..ed6a7338219 100644 --- a/.evergreen/config.yml +++ b/.evergreen/config.yml @@ -452,7 +452,6 @@ tasks: tags: - latest - server - - full-suite commands: - func: install dependencies - func: bootstrap mongo-orchestration @@ -464,7 +463,6 @@ tasks: tags: - latest - replica_set - - full-suite commands: - func: install dependencies - func: bootstrap mongo-orchestration @@ -476,7 +474,6 @@ tasks: tags: - latest - sharded_cluster - - full-suite commands: - func: install dependencies - func: bootstrap mongo-orchestration @@ -488,7 +485,6 @@ tasks: tags: - latest - server-unified - - full-suite commands: - func: install dependencies - func: bootstrap mongo-orchestration @@ -502,7 +498,6 @@ tasks: tags: - latest - replica_set-unified - - full-suite commands: - func: install dependencies - func: bootstrap mongo-orchestration @@ -516,7 +511,6 @@ tasks: tags: - latest - sharded_cluster-unified - - full-suite commands: - func: install dependencies - func: bootstrap mongo-orchestration @@ -530,7 +524,6 @@ tasks: tags: - '4.4' - server - - full-suite commands: - func: install dependencies - func: bootstrap mongo-orchestration @@ -542,7 +535,6 @@ tasks: tags: - '4.4' - replica_set - - full-suite commands: - func: install dependencies - func: bootstrap mongo-orchestration @@ -554,7 +546,6 @@ tasks: tags: - '4.4' - sharded_cluster - - full-suite commands: - func: install dependencies - func: bootstrap mongo-orchestration @@ -566,7 +557,6 @@ tasks: tags: - '4.4' - server-unified - - full-suite commands: - func: install dependencies - func: bootstrap mongo-orchestration @@ -580,7 +570,6 @@ tasks: tags: - '4.4' - replica_set-unified - - full-suite commands: - func: install dependencies - func: bootstrap mongo-orchestration @@ -594,7 +583,6 @@ tasks: tags: - '4.4' - sharded_cluster-unified - - full-suite commands: - func: install dependencies - func: bootstrap mongo-orchestration @@ -608,7 +596,6 @@ tasks: tags: - '4.2' - server - - full-suite commands: - func: install dependencies - func: bootstrap mongo-orchestration @@ -620,7 +607,6 @@ tasks: tags: - '4.2' - replica_set - - full-suite commands: - func: install dependencies - func: bootstrap mongo-orchestration @@ -632,7 +618,6 @@ tasks: tags: - '4.2' - sharded_cluster - - full-suite commands: - func: install dependencies - func: bootstrap mongo-orchestration @@ -644,7 +629,6 @@ tasks: tags: - '4.2' - server-unified - - full-suite commands: - func: install dependencies - func: bootstrap mongo-orchestration @@ -658,7 +642,6 @@ tasks: tags: - '4.2' - replica_set-unified - - full-suite commands: - func: install dependencies - func: bootstrap mongo-orchestration @@ -672,7 +655,6 @@ tasks: tags: - '4.2' - sharded_cluster-unified - - full-suite commands: - func: install dependencies - func: bootstrap mongo-orchestration @@ -686,7 +668,6 @@ tasks: tags: - '4.0' - server - - full-suite commands: - func: install dependencies - func: bootstrap mongo-orchestration @@ -698,7 +679,6 @@ tasks: tags: - '4.0' - replica_set - - full-suite commands: - func: install dependencies - func: bootstrap mongo-orchestration @@ -710,7 +690,6 @@ tasks: tags: - '4.0' - sharded_cluster - - full-suite commands: - func: install dependencies - func: bootstrap mongo-orchestration @@ -722,7 +701,6 @@ tasks: tags: - '4.0' - server-unified - - full-suite commands: - func: install dependencies - func: bootstrap mongo-orchestration @@ -736,7 +714,6 @@ tasks: tags: - '4.0' - replica_set-unified - - full-suite commands: - func: install dependencies - func: bootstrap mongo-orchestration @@ -750,7 +727,6 @@ tasks: tags: - '4.0' - sharded_cluster-unified - - full-suite commands: - func: install dependencies - func: bootstrap mongo-orchestration @@ -764,7 +740,6 @@ tasks: tags: - '3.6' - server - - full-suite commands: - func: install dependencies - func: bootstrap mongo-orchestration @@ -776,7 +751,6 @@ tasks: tags: - '3.6' - replica_set - - full-suite commands: - func: install dependencies - func: bootstrap mongo-orchestration @@ -788,7 +762,6 @@ tasks: tags: - '3.6' - sharded_cluster - - full-suite commands: - func: install dependencies - func: bootstrap mongo-orchestration @@ -800,7 +773,6 @@ tasks: tags: - '3.6' - server-unified - - full-suite commands: - func: install dependencies - func: bootstrap mongo-orchestration @@ -814,7 +786,6 @@ tasks: tags: - '3.6' - replica_set-unified - - full-suite commands: - func: install dependencies - func: bootstrap mongo-orchestration @@ -828,7 +799,6 @@ tasks: tags: - '3.6' - sharded_cluster-unified - - full-suite commands: - func: install dependencies - func: bootstrap mongo-orchestration @@ -842,7 +812,6 @@ tasks: tags: - '3.4' - server - - full-suite commands: - func: install dependencies - func: bootstrap mongo-orchestration @@ -854,7 +823,6 @@ tasks: tags: - '3.4' - replica_set - - full-suite commands: - func: install dependencies - func: bootstrap mongo-orchestration @@ -866,7 +834,6 @@ tasks: tags: - '3.4' - sharded_cluster - - full-suite commands: - func: install dependencies - func: bootstrap mongo-orchestration @@ -878,7 +845,6 @@ tasks: tags: - '3.4' - server-unified - - full-suite commands: - func: install dependencies - func: bootstrap mongo-orchestration @@ -892,7 +858,6 @@ tasks: tags: - '3.4' - replica_set-unified - - full-suite commands: - func: install dependencies - func: bootstrap mongo-orchestration @@ -906,7 +871,6 @@ tasks: tags: - '3.4' - sharded_cluster-unified - - full-suite commands: - func: install dependencies - func: bootstrap mongo-orchestration @@ -920,7 +884,6 @@ tasks: tags: - '3.2' - server - - full-suite commands: - func: install dependencies - func: bootstrap mongo-orchestration @@ -932,7 +895,6 @@ tasks: tags: - '3.2' - replica_set - - full-suite commands: - func: install dependencies - func: bootstrap mongo-orchestration @@ -944,7 +906,6 @@ tasks: tags: - '3.2' - sharded_cluster - - full-suite commands: - func: install dependencies - func: bootstrap mongo-orchestration @@ -956,7 +917,6 @@ tasks: tags: - '3.2' - server-unified - - full-suite commands: - func: install dependencies - func: bootstrap mongo-orchestration @@ -970,7 +930,6 @@ tasks: tags: - '3.2' - replica_set-unified - - full-suite commands: - func: install dependencies - func: bootstrap mongo-orchestration @@ -984,7 +943,6 @@ tasks: tags: - '3.2' - sharded_cluster-unified - - full-suite commands: - func: install dependencies - func: bootstrap mongo-orchestration @@ -998,7 +956,6 @@ tasks: tags: - '3.0' - server - - full-suite commands: - func: install dependencies - func: bootstrap mongo-orchestration @@ -1010,7 +967,6 @@ tasks: tags: - '3.0' - replica_set - - full-suite commands: - func: install dependencies - func: bootstrap mongo-orchestration @@ -1022,7 +978,6 @@ tasks: tags: - '3.0' - sharded_cluster - - full-suite commands: - func: install dependencies - func: bootstrap mongo-orchestration @@ -1034,7 +989,6 @@ tasks: tags: - '3.0' - server-unified - - full-suite commands: - func: install dependencies - func: bootstrap mongo-orchestration @@ -1048,7 +1002,6 @@ tasks: tags: - '3.0' - replica_set-unified - - full-suite commands: - func: install dependencies - func: bootstrap mongo-orchestration @@ -1062,7 +1015,6 @@ tasks: tags: - '3.0' - sharded_cluster-unified - - full-suite commands: - func: install dependencies - func: bootstrap mongo-orchestration @@ -1076,7 +1028,6 @@ tasks: tags: - '2.6' - server - - full-suite commands: - func: install dependencies - func: bootstrap mongo-orchestration @@ -1088,7 +1039,6 @@ tasks: tags: - '2.6' - replica_set - - full-suite commands: - func: install dependencies - func: bootstrap mongo-orchestration @@ -1100,7 +1050,6 @@ tasks: tags: - '2.6' - sharded_cluster - - full-suite commands: - func: install dependencies - func: bootstrap mongo-orchestration @@ -1112,7 +1061,6 @@ tasks: tags: - '2.6' - server-unified - - full-suite commands: - func: install dependencies - func: bootstrap mongo-orchestration @@ -1126,7 +1074,6 @@ tasks: tags: - '2.6' - replica_set-unified - - full-suite commands: - func: install dependencies - func: bootstrap mongo-orchestration @@ -1140,7 +1087,6 @@ tasks: tags: - '2.6' - sharded_cluster-unified - - full-suite commands: - func: install dependencies - func: bootstrap mongo-orchestration diff --git a/.evergreen/generate_evergreen_tasks.js b/.evergreen/generate_evergreen_tasks.js index bc33d92a9c5..9b51c484eb9 100644 --- a/.evergreen/generate_evergreen_tasks.js +++ b/.evergreen/generate_evergreen_tasks.js @@ -79,13 +79,12 @@ const OPERATING_SYSTEMS = [ ) ); +const BASE_TASKS = []; const TASKS = []; const SINGLETON_TASKS = []; -function makeTask({ mongoVersion, topology, tags }) { +function makeTask({ mongoVersion, topology }) { let topologyForTest = topology; - if (!tags) tags = []; - tags.unshift(mongoVersion, topology); let runTestsCommand = { func: 'run tests' }; if (topology.indexOf('-unified') !== -1) { topologyForTest = topology.split('-unified')[0]; @@ -94,7 +93,7 @@ function makeTask({ mongoVersion, topology, tags }) { return { name: `test-${mongoVersion}-${topology}`, - tags, + tags: [mongoVersion, topology], commands: [ { func: 'install dependencies' }, { @@ -111,7 +110,7 @@ function makeTask({ mongoVersion, topology, tags }) { MONGODB_VERSIONS.forEach(mongoVersion => { TOPOLOGIES.forEach(topology => - TASKS.push(makeTask({ mongoVersion, topology, tags: ['full-suite'] })) + BASE_TASKS.push(makeTask({ mongoVersion, topology })) ); }); @@ -325,15 +324,14 @@ const BUILD_VARIANTS = []; const getTaskList = (() => { const memo = {}; - return function(mongoVersion, onlyFullSuite = false) { - const key = mongoVersion + (onlyFullSuite ? 'F' : ''); + return function(mongoVersion, onlyBaseTasks = false) { + const key = mongoVersion + (onlyBaseTasks ? 'b' : ''); if (memo[key]) { return memo[key]; } - - const ret = TASKS.filter(task => { - if (onlyFullSuite && (!task.tags || !task.tags.includes('full-suite'))) return false; + 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; @@ -425,7 +423,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'); From a28ee21f9254a4d02ae5c9903aa51fd7cbfece23 Mon Sep 17 00:00:00 2001 From: emadum Date: Wed, 2 Dec 2020 16:01:28 -0500 Subject: [PATCH 07/10] msvs2010 no longer supported on evergreen --- .evergreen/config.yml | 43 +++----------------------- .evergreen/generate_evergreen_tasks.js | 7 ----- 2 files changed, 4 insertions(+), 46 deletions(-) diff --git a/.evergreen/config.yml b/.evergreen/config.yml index ed6a7338219..0ab8d874681 100644 --- a/.evergreen/config.yml +++ b/.evergreen/config.yml @@ -1672,12 +1672,12 @@ buildvariants: NODE_LTS_NAME: argon CLIENT_ENCRYPTION: true tasks: *ref_2 - - name: windows-64-vs2010-erbium - display_name: Windows (VS2010) Node Erbium - run_on: windows-64-vs2010-large + - name: windows-64-vs2013-erbium + display_name: Windows (VS2013) Node Erbium + run_on: windows-64-vs2013-large expansions: NODE_LTS_NAME: erbium - MSVS_VERSION: 2010 + MSVS_VERSION: 2013 tasks: &ref_3 - test-4.2-server - test-4.2-replica_set @@ -1721,41 +1721,6 @@ buildvariants: - test-2.6-server-unified - test-2.6-replica_set-unified - test-2.6-sharded_cluster-unified - - name: windows-64-vs2010-dubnium - display_name: Windows (VS2010) Node Dubnium - run_on: windows-64-vs2010-large - expansions: - NODE_LTS_NAME: dubnium - MSVS_VERSION: 2010 - tasks: *ref_3 - - name: windows-64-vs2010-carbon - display_name: Windows (VS2010) Node Carbon - run_on: windows-64-vs2010-large - expansions: - NODE_LTS_NAME: carbon - MSVS_VERSION: 2010 - tasks: *ref_3 - - name: windows-64-vs2010-boron - display_name: Windows (VS2010) Node Boron - run_on: windows-64-vs2010-large - expansions: - NODE_LTS_NAME: boron - MSVS_VERSION: 2010 - tasks: *ref_3 - - name: windows-64-vs2010-argon - display_name: Windows (VS2010) Node Argon - run_on: windows-64-vs2010-large - expansions: - NODE_LTS_NAME: argon - MSVS_VERSION: 2010 - tasks: *ref_3 - - name: windows-64-vs2013-erbium - display_name: Windows (VS2013) Node Erbium - run_on: windows-64-vs2013-large - expansions: - NODE_LTS_NAME: erbium - MSVS_VERSION: 2013 - tasks: *ref_3 - name: windows-64-vs2013-dubnium display_name: Windows (VS2013) Node Dubnium run_on: windows-64-vs2013-large diff --git a/.evergreen/generate_evergreen_tasks.js b/.evergreen/generate_evergreen_tasks.js index 9b51c484eb9..5086866bda3 100644 --- a/.evergreen/generate_evergreen_tasks.js +++ b/.evergreen/generate_evergreen_tasks.js @@ -40,13 +40,6 @@ const OPERATING_SYSTEMS = [ mongoVersion: '>=3.2', clientEncryption: true }, - { - name: 'windows-64-vs2010', - display_name: 'Windows (VS2010)', - run_on: 'windows-64-vs2010-large', - msvsVersion: 2010, - mongoVersion: '<4.4' - }, { name: 'windows-64-vs2013', display_name: 'Windows (VS2013)', From 8461c8a4352ebb30ce39d3f9a853dde4dcf00214 Mon Sep 17 00:00:00 2001 From: emadum Date: Wed, 2 Dec 2020 17:27:27 -0500 Subject: [PATCH 08/10] skip leaking tests --- test/functional/core/tailable_cursor.test.js | 4 +--- test/functional/cursor.test.js | 5 +++-- test/functional/operation_example.test.js | 4 +--- test/functional/operation_generators_example.test.js | 10 ++++++++-- test/functional/operation_promises_example.test.js | 9 +++++++-- 5 files changed, 20 insertions(+), 12 deletions(-) diff --git a/test/functional/core/tailable_cursor.test.js b/test/functional/core/tailable_cursor.test.js index 46fa74cd3d4..6731c72de91 100644 --- a/test/functional/core/tailable_cursor.test.js +++ b/test/functional/core/tailable_cursor.test.js @@ -10,9 +10,7 @@ describe('Tailable cursor tests', function() { }); it('should correctly perform awaitdata', { - metadata: { - requires: { topology: ['single', 'replicaset', 'sharded'] } - }, + metadata: { requires: { os: '!win32' } }, // leaks on windows test: function(done) { var self = this; diff --git a/test/functional/cursor.test.js b/test/functional/cursor.test.js index 765346a5328..c1034b75ab3 100644 --- a/test/functional/cursor.test.js +++ b/test/functional/cursor.test.js @@ -2287,7 +2287,8 @@ describe('Cursor', function() { // 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' // leaks on windows }, // The actual test we wish to run @@ -2346,7 +2347,7 @@ describe('Cursor', function() { test.equal(null, err); if (id === 99) { - setTimeout(() => client.close(validator)); + setTimeout(() => client.close()); } }); }); diff --git a/test/functional/operation_example.test.js b/test/functional/operation_example.test.js index 14e4010772b..e60b81f12c0 100644 --- a/test/functional/operation_example.test.js +++ b/test/functional/operation_example.test.js @@ -9354,9 +9354,7 @@ describe('Operation Examples', function() { * @ignore */ it('Should correctly add capped collection options to cursor', { - metadata: { - requires: { topology: ['single', 'replicaset', 'sharded', 'ssl', 'heap', 'wiredtiger'] } - }, + metadata: { requires: { os: '!win32' } }, // leaks on windows // The actual test we wish to run test: function(done) { diff --git a/test/functional/operation_generators_example.test.js b/test/functional/operation_generators_example.test.js index 1125da9db98..6764535e3d0 100644 --- a/test/functional/operation_generators_example.test.js +++ b/test/functional/operation_generators_example.test.js @@ -6464,7 +6464,13 @@ describe('Operation (Generators)', function() { * @ignore */ it('Should correctly add capped collection options to cursor with Generators', { - metadata: { requires: { generators: true, topology: ['single'] } }, + metadata: { + requires: { + generators: true, + topology: ['single'], + os: '!win32' // leaks on windows + } + }, // The actual test we wish to run test: function() { @@ -6492,7 +6498,7 @@ describe('Operation (Generators)', function() { var collection = yield db.createCollection('a_simple_collection_2_with_generators', { capped: true, size: 100000, - max: 10000, + max: 1000, w: 1 }); var docs = []; diff --git a/test/functional/operation_promises_example.test.js b/test/functional/operation_promises_example.test.js index b73d8c06801..71a6ebf1e2e 100644 --- a/test/functional/operation_promises_example.test.js +++ b/test/functional/operation_promises_example.test.js @@ -7036,7 +7036,12 @@ describe('Operation (Promises)', function() { * @ignore */ it('Should correctly add capped collection options to cursor With Promises', { - metadata: { requires: { topology: ['single'] } }, + metadata: { + requires: { + topology: ['single'], + os: '!win32' // leaks on windows + } + }, // The actual test we wish to run test: function(done) { @@ -7062,7 +7067,7 @@ describe('Operation (Promises)', function() { db.createCollection('a_simple_collection_2_with_promise', { capped: true, size: 100000, - max: 10000, + max: 1000, w: 1 }) .then(function(_collection) { From 34d897c622b498bcf43d8def25f5f294d2058e12 Mon Sep 17 00:00:00 2001 From: emadum Date: Thu, 3 Dec 2020 09:33:56 -0500 Subject: [PATCH 09/10] add ticket names to skipped tests --- test/functional/cmap/connection.test.js | 6 +++++- test/functional/core/rs_mocks/connection.test.js | 4 ++-- test/functional/core/tailable_cursor.test.js | 6 +++++- test/functional/cursor.test.js | 8 ++++++-- test/functional/operation_example.test.js | 6 +++++- test/functional/operation_generators_example.test.js | 2 +- test/functional/operation_promises_example.test.js | 2 +- test/unit/core/connect.test.js | 6 +++++- 8 files changed, 30 insertions(+), 10 deletions(-) diff --git a/test/functional/cmap/connection.test.js b/test/functional/cmap/connection.test.js index cd9b5286ef0..98a0834777f 100644 --- a/test/functional/cmap/connection.test.js +++ b/test/functional/cmap/connection.test.js @@ -62,7 +62,11 @@ describe('Connection', function() { }); it('should support socket timeouts', { - metadata: { requires: { os: '!win32' } }, // 240.0.0.1 doesnt work for windows + 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', diff --git a/test/functional/core/rs_mocks/connection.test.js b/test/functional/core/rs_mocks/connection.test.js index 31cb957593e..1d9281d1fdb 100644 --- a/test/functional/core/rs_mocks/connection.test.js +++ b/test/functional/core/rs_mocks/connection.test.js @@ -266,7 +266,7 @@ describe('ReplSet Connection Tests (mocks)', function() { requires: { generators: true, topology: 'single', - os: '!win32' + os: '!win32' // NODE-2943: timeout on windows } }, @@ -374,7 +374,7 @@ describe('ReplSet Connection Tests (mocks)', function() { requires: { generators: true, topology: 'single', - os: '!win32' + os: '!win32' // NODE-2943: timeout on windows } }, diff --git a/test/functional/core/tailable_cursor.test.js b/test/functional/core/tailable_cursor.test.js index 6731c72de91..c48907f69c9 100644 --- a/test/functional/core/tailable_cursor.test.js +++ b/test/functional/core/tailable_cursor.test.js @@ -10,7 +10,11 @@ describe('Tailable cursor tests', function() { }); it('should correctly perform awaitdata', { - metadata: { requires: { os: '!win32' } }, // leaks on windows + metadata: { + requires: { + os: '!win32' // NODE-2943: timeout on windows + } + }, test: function(done) { var self = this; diff --git a/test/functional/cursor.test.js b/test/functional/cursor.test.js index c1034b75ab3..9b3588ff538 100644 --- a/test/functional/cursor.test.js +++ b/test/functional/cursor.test.js @@ -2217,7 +2217,11 @@ describe('Cursor', function() { it('cursor stream pipe', { // 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: { os: '!win32' } }, + metadata: { + requires: { + os: '!win32' // NODE-2943: timeout on windows + } + }, // The actual test we wish to run test: function(done) { @@ -2288,7 +2292,7 @@ describe('Cursor', function() { metadata: { requires: { topology: ['single', 'replicaset', 'sharded', 'ssl', 'heap', 'wiredtiger'] }, sessions: { skipLeakTests: true }, - os: '!win32' // leaks on windows + os: '!win32' // NODE-2943: timeout on windows }, // The actual test we wish to run diff --git a/test/functional/operation_example.test.js b/test/functional/operation_example.test.js index e60b81f12c0..189e7ee069a 100644 --- a/test/functional/operation_example.test.js +++ b/test/functional/operation_example.test.js @@ -9354,7 +9354,11 @@ describe('Operation Examples', function() { * @ignore */ it('Should correctly add capped collection options to cursor', { - metadata: { requires: { os: '!win32' } }, // leaks on windows + metadata: { + requires: { + os: '!win32' // NODE-2943: timeout on windows + } + }, // The actual test we wish to run test: function(done) { diff --git a/test/functional/operation_generators_example.test.js b/test/functional/operation_generators_example.test.js index 6764535e3d0..8054e446723 100644 --- a/test/functional/operation_generators_example.test.js +++ b/test/functional/operation_generators_example.test.js @@ -6468,7 +6468,7 @@ describe('Operation (Generators)', function() { requires: { generators: true, topology: ['single'], - os: '!win32' // leaks on windows + os: '!win32' // NODE-2943: timeout on windows } }, diff --git a/test/functional/operation_promises_example.test.js b/test/functional/operation_promises_example.test.js index 71a6ebf1e2e..71a0e0424e6 100644 --- a/test/functional/operation_promises_example.test.js +++ b/test/functional/operation_promises_example.test.js @@ -7039,7 +7039,7 @@ describe('Operation (Promises)', function() { metadata: { requires: { topology: ['single'], - os: '!win32' // leaks on windows + os: '!win32' // NODE-2943: timeout on windows } }, diff --git a/test/unit/core/connect.test.js b/test/unit/core/connect.test.js index e334c0466d0..746b0645af0 100644 --- a/test/unit/core/connect.test.js +++ b/test/unit/core/connect.test.js @@ -101,7 +101,11 @@ describe('Connect Tests', function() { }); it('should allow a cancellaton token', { - metadata: { requires: { os: '!win32' } }, // 240.0.0.1 doesnt work for windows + 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); From d218816dc8192e3f9b5c9fff1808f0b0344b67f5 Mon Sep 17 00:00:00 2001 From: emadum Date: Thu, 3 Dec 2020 12:42:07 -0500 Subject: [PATCH 10/10] dont fail on which --- .evergreen/install-dependencies.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.evergreen/install-dependencies.sh b/.evergreen/install-dependencies.sh index be0cbd7b01a..2c4d52e74cd 100644 --- a/.evergreen/install-dependencies.sh +++ b/.evergreen/install-dependencies.sh @@ -77,8 +77,8 @@ path: $NVM_SYMLINK EOT nvm install $NODE_VERSION nvm use $NODE_VERSION - which node - which npm + 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