diff options
Diffstat (limited to 'jstests')
238 files changed, 310 insertions, 30 deletions
diff --git a/jstests/aggregation/sources/graphLookup/sharded.js b/jstests/aggregation/sources/graphLookup/sharded.js index d54e2be01c8..78429a5af6d 100644 --- a/jstests/aggregation/sources/graphLookup/sharded.js +++ b/jstests/aggregation/sources/graphLookup/sharded.js @@ -51,4 +51,5 @@ load("jstests/aggregation/extras/utils.js"); // For assertErrorCode. }; assertErrorCode(foreign, pipeline, 28769); + st.stop(); }()); diff --git a/jstests/auth/access_control_with_unreachable_configs.js b/jstests/auth/access_control_with_unreachable_configs.js index 3d7f9ab24a6..644fd4c63cb 100644 --- a/jstests/auth/access_control_with_unreachable_configs.js +++ b/jstests/auth/access_control_with_unreachable_configs.js @@ -44,3 +44,4 @@ var db2 = conn2.getDB('admin'); // should fail since user is not authorized. assert.commandFailedWithCode(db2.adminCommand('serverStatus'), authzErrorCode); +st.stop(); diff --git a/jstests/auth/arbiter.js b/jstests/auth/arbiter.js index df9f85a8015..0ad5087f565 100644 --- a/jstests/auth/arbiter.js +++ b/jstests/auth/arbiter.js @@ -30,3 +30,5 @@ assert.commandFailedWithCode(primaryAdmin.runCommand(cmd2), 13); assert.commandWorked(arbiterAdmin.runCommand(cmd0)); assert.commandWorked(arbiterAdmin.runCommand(cmd1)); assert.commandWorked(arbiterAdmin.runCommand(cmd2)); + +replTest.stopSet(); diff --git a/jstests/auth/auth1.js b/jstests/auth/auth1.js index d4ba3fe033d..183317414df 100644 --- a/jstests/auth/auth1.js +++ b/jstests/auth/auth1.js @@ -117,3 +117,4 @@ function runTest(m) { var m = setupTest(); runTest(m); +MongoRunner.stopMongod(m, null, {user: "root", pwd: "root"}); diff --git a/jstests/auth/auth2.js b/jstests/auth/auth2.js index f09d87d7275..9d2b5047e20 100644 --- a/jstests/auth/auth2.js +++ b/jstests/auth/auth2.js @@ -30,3 +30,4 @@ users = db.getCollection("system.users"); assert.eq(1, users.count()); db.shutdownServer(); +waitProgram(m.pid); diff --git a/jstests/auth/auth3.js b/jstests/auth/auth3.js index 3642fedb12c..6ded435c508 100644 --- a/jstests/auth/auth3.js +++ b/jstests/auth/auth3.js @@ -29,4 +29,5 @@ assert("info" in admin.killOp(123)); assert.eq(admin.fsyncUnlock().errmsg, "fsyncUnlock called when not locked"); + MongoRunner.stopMongod(conn, null, {user: "foo", pwd: "bar"}); })(); diff --git a/jstests/auth/auth_helpers.js b/jstests/auth/auth_helpers.js index 94131821784..814c867a176 100644 --- a/jstests/auth/auth_helpers.js +++ b/jstests/auth/auth_helpers.js @@ -63,3 +63,4 @@ assert(testedSomething, "No candidate authentication mechanisms matched."); // Invalid mechanisms shouldn't lead to authentication, but also shouldn't crash. assert(!admin.auth({mechanism: 'this-mechanism-is-fake', user: 'andy', pwd: 'a'})); +MongoRunner.stopMongod(conn); diff --git a/jstests/auth/db_multiple_login.js b/jstests/auth/db_multiple_login.js index 4a16efdf0f6..dfb8c4a65b0 100644 --- a/jstests/auth/db_multiple_login.js +++ b/jstests/auth/db_multiple_login.js @@ -28,3 +28,4 @@ test.foo.findOne(); test.auth('reader', 'a'); assert.writeError(test.docs.insert({value: 2})); test.foo.findOne(); +MongoRunner.stopMongod(conn, null, {user: 'admin', pwd: 'a'}); diff --git a/jstests/auth/disable_localhost_bypass.js b/jstests/auth/disable_localhost_bypass.js index a33d582cf15..1cdcd1042d5 100644 --- a/jstests/auth/disable_localhost_bypass.js +++ b/jstests/auth/disable_localhost_bypass.js @@ -28,3 +28,5 @@ assert.throws(function() { }); print("SUCCESS Completed disable_localhost_bypass.js"); +MongoRunner.stopMongod(conn1, null, {user: "root", pwd: "pass"}); +MongoRunner.stopMongod(conn2, null, {user: "root", pwd: "pass"}); diff --git a/jstests/auth/explain_auth.js b/jstests/auth/explain_auth.js index 70570324260..14fdcd8d51c 100644 --- a/jstests/auth/explain_auth.js +++ b/jstests/auth/explain_auth.js @@ -103,3 +103,5 @@ db.logout(); db.auth("removeOnly", "pwd"); testExplainAuth({find: false, count: false, group: false, remove: true, update: false}); db.logout(); + +MongoRunner.stopMongod(conn, null, {user: "adminUser", pwd: "pwd"}); diff --git a/jstests/auth/indexSystemUsers.js b/jstests/auth/indexSystemUsers.js index 55baae11327..aa8d2a32b7f 100644 --- a/jstests/auth/indexSystemUsers.js +++ b/jstests/auth/indexSystemUsers.js @@ -34,3 +34,4 @@ adminDB.logout(); adminDB.auth('admin', 'x'); // Make sure that no users were actually dropped assert.eq(3, adminDB.system.users.count()); +MongoRunner.stopMongod(conn, null, {user: 'admin', pwd: 'x'}); diff --git a/jstests/auth/js_scope_leak.js b/jstests/auth/js_scope_leak.js index 847919debf1..cb2be813722 100644 --- a/jstests/auth/js_scope_leak.js +++ b/jstests/auth/js_scope_leak.js @@ -145,3 +145,5 @@ function testGroup() { } testGroup(); testGroup(); + +MongoRunner.stopMongod(conn); diff --git a/jstests/auth/localhostAuthBypass.js b/jstests/auth/localhostAuthBypass.js index 57319c0b6a1..e3bb03b661d 100644 --- a/jstests/auth/localhostAuthBypass.js +++ b/jstests/auth/localhostAuthBypass.js @@ -193,6 +193,7 @@ var runRoleTest = function() { conn = MongoRunner.runMongod({auth: '', dbpath: dbpath, restart: true, cleanData: false}); mongo = new Mongo("localhost:" + conn.port); assertCannotRunCommands(mongo); + MongoRunner.stopMongod(conn); }; runTest(false, false); diff --git a/jstests/auth/pre_auth_commands_with_sessions.js b/jstests/auth/pre_auth_commands_with_sessions.js index 430b10a8376..27009a530ad 100644 --- a/jstests/auth/pre_auth_commands_with_sessions.js +++ b/jstests/auth/pre_auth_commands_with_sessions.js @@ -58,5 +58,5 @@ for (var i = 0; i < commands.length; i++) { testCommand(commands[i]); } - + MongoRunner.stopMongod(conn, null, {user: "admin", pwd: "pwd"}); })(); diff --git a/jstests/auth/profile.js b/jstests/auth/profile.js index 41a8d86f8a9..6708451eabd 100644 --- a/jstests/auth/profile.js +++ b/jstests/auth/profile.js @@ -49,3 +49,4 @@ assert((db1 == last.allUsers[0].db && db2 == last.allUsers[1].db) || db1.setProfilingLevel(0); db1.dropDatabase(); db2.dropDatabase(); +MongoRunner.stopMongod(conn); diff --git a/jstests/auth/profile_access.js b/jstests/auth/profile_access.js index e7090ef3b0d..b4b9afcec34 100644 --- a/jstests/auth/profile_access.js +++ b/jstests/auth/profile_access.js @@ -37,4 +37,5 @@ testDb.logout(); testDb.auth('dbAdminAnyDBUser', 'password'); testDb.setProfilingLevel(0); testDb.system.profile.drop(); -assert.commandWorked(testDb.createCollection("system.profile", {capped: true, size: 1024}));
\ No newline at end of file +assert.commandWorked(testDb.createCollection("system.profile", {capped: true, size: 1024})); +MongoRunner.stopMongod(conn, null, {user: 'admin', pwd: 'password'}); diff --git a/jstests/auth/readIndex.js b/jstests/auth/readIndex.js index deda8717a3b..d280dc45517 100644 --- a/jstests/auth/readIndex.js +++ b/jstests/auth/readIndex.js @@ -19,3 +19,4 @@ var indexList = testDB.foo.getIndexes().filter(function(idx) { }); assert.eq(1, indexList.length, tojson(indexList)); assert.docEq(indexList[0].key, {a: 1}, tojson(indexList)); +MongoRunner.stopMongod(conn, null, {user: 'root', pwd: 'password'}); diff --git a/jstests/auth/rename.js b/jstests/auth/rename.js index bc1d8a40923..c397ff1ad4b 100644 --- a/jstests/auth/rename.js +++ b/jstests/auth/rename.js @@ -41,3 +41,5 @@ assert.commandWorked( assert.eq(db1.a.count(), 0); assert.eq(db1.b.count(), 0); assert.eq(db2.a.count(), 1); + +MongoRunner.stopMongod(m, null, {user: 'admin', pwd: 'password'}); diff --git a/jstests/auth/renameSystemCollections.js b/jstests/auth/renameSystemCollections.js index 32b2478095d..e97706bb6bf 100644 --- a/jstests/auth/renameSystemCollections.js +++ b/jstests/auth/renameSystemCollections.js @@ -75,3 +75,4 @@ assert.eq(1, res.ok, tojson(res)); // At this point, all the user documents are gone, so further activity may be unauthorized, // depending on cluster configuration. So, this is the end of the test. +MongoRunner.stopMongod(conn, {user: 'userAdmin', pwd: 'password'}); diff --git a/jstests/auth/show_log_auth.js b/jstests/auth/show_log_auth.js index 05df5f20610..226b38a6670 100644 --- a/jstests/auth/show_log_auth.js +++ b/jstests/auth/show_log_auth.js @@ -27,3 +27,4 @@ assertStartsWith(print db.auth("admin", "pass"); db.shutdownServer(); +waitProgram(m.pid); diff --git a/jstests/auth/system_roles_collMod.js b/jstests/auth/system_roles_collMod.js index 6474ace1dfb..b06920a4c00 100644 --- a/jstests/auth/system_roles_collMod.js +++ b/jstests/auth/system_roles_collMod.js @@ -3,7 +3,8 @@ (function() { 'use strict'; print("START auth-system-roles-collMod.js"); - var db = MongoRunner.runMongod({}).getDB("test"); + var conn = MongoRunner.runMongod({}); + var db = conn.getDB("test"); assert.commandWorked(db.runCommand( {createRole: "role1", roles: [{role: "readWrite", db: "test"}], privileges: []})); @@ -18,4 +19,5 @@ assert(db.runCommand({rolesInfo: "role1"}).roles.length === 0); print("SUCCESS auth-system-roles-collMod.js"); + MongoRunner.stopMongod(conn); })(); diff --git a/jstests/auth/system_user_privileges.js b/jstests/auth/system_user_privileges.js index 2e49a9d5d9a..548dbf7eccd 100644 --- a/jstests/auth/system_user_privileges.js +++ b/jstests/auth/system_user_privileges.js @@ -98,4 +98,5 @@ assertCountUnauthorized(conn, "local", "foo"); assertCountUnauthorized(conn, "test", "foo"); + MongoRunner.stopMongod(conn, null, {user: 'admin', pwd: 'a'}); })(); diff --git a/jstests/auth/user_defined_roles_on_secondaries.js b/jstests/auth/user_defined_roles_on_secondaries.js index c405363c575..03b935ab590 100644 --- a/jstests/auth/user_defined_roles_on_secondaries.js +++ b/jstests/auth/user_defined_roles_on_secondaries.js @@ -207,4 +207,5 @@ assertListContainsRole(role.roles, {role: "readWrite", db: "db1"}, node); }); + rstest.stopSet(); }()); diff --git a/jstests/disk/dbNoCreate.js b/jstests/disk/dbNoCreate.js index 66c2cc74ad6..2d48afad92e 100644 --- a/jstests/disk/dbNoCreate.js +++ b/jstests/disk/dbNoCreate.js @@ -14,3 +14,4 @@ MongoRunner.stopMongod(m); m = MongoRunner.runMongod({restart: true, cleanData: false, dbpath: m.dbpath}); assert.eq( -1, m.getDBNames().indexOf(baseName), "found " + baseName + " in " + tojson(m.getDBNames())); +MongoRunner.stopMongod(m); diff --git a/jstests/disk/directoryperdb.js b/jstests/disk/directoryperdb.js index 5d812d855f4..a5f45e232bb 100644 --- a/jstests/disk/directoryperdb.js +++ b/jstests/disk/directoryperdb.js @@ -169,3 +169,4 @@ if (!_isWindows()) { assertDocumentCount(dbUU, 1); m = checkDBFilesInDBDirectory(m, dbUU); } +MongoRunner.stopMongod(m); diff --git a/jstests/master_slave/initial_sync_wc2.js b/jstests/master_slave/initial_sync_wc2.js index 8f15f076b03..ed7232c576b 100644 --- a/jstests/master_slave/initial_sync_wc2.js +++ b/jstests/master_slave/initial_sync_wc2.js @@ -18,4 +18,5 @@ var slave = rt.start(false); // Perform a w=2 write to ensure that slave can be read from, and initial sync is complete. assert.writeOK(master.getDB("test").mycoll.insert({}, {writeConcern: {w: 2}})); -assert.eq(1, slave.getDB("test").mycoll.find({}).itcount());
\ No newline at end of file +assert.eq(1, slave.getDB("test").mycoll.find({}).itcount()); +rt.stop(); diff --git a/jstests/master_slave/repair.js b/jstests/master_slave/repair.js index b654244eb2b..2ef7360ed58 100644 --- a/jstests/master_slave/repair.js +++ b/jstests/master_slave/repair.js @@ -12,3 +12,4 @@ assert.automsg("c > 0"); assert.commandWorked(m.getDB("local").repairDatabase()); assert.automsg("c <= m.getDB( 'local' ).oplog.$main.count()"); +rt.stop(); diff --git a/jstests/master_slave/repl12.js b/jstests/master_slave/repl12.js index 9771a48178e..843b08ebfa8 100644 --- a/jstests/master_slave/repl12.js +++ b/jstests/master_slave/repl12.js @@ -48,3 +48,4 @@ assert.soon(function() { }); // printjson(s.getDBNames()); +rt.stop(); diff --git a/jstests/master_slave/repl13.js b/jstests/master_slave/repl13.js index c560f285cf4..18118f33788 100644 --- a/jstests/master_slave/repl13.js +++ b/jstests/master_slave/repl13.js @@ -63,3 +63,4 @@ s_hash = s.getDB("d").runCommand("dbhash"); assert.eq( m_hash.collections.c, s_hash.collections.c, "sad " + tojson(m_hash) + " " + tojson(s_hash)); +rt.stop(); diff --git a/jstests/master_slave/repl8.js b/jstests/master_slave/repl8.js index e9ddba94729..18106d4815b 100644 --- a/jstests/master_slave/repl8.js +++ b/jstests/master_slave/repl8.js @@ -41,3 +41,4 @@ assert(m.getDB(baseName).getCollection("fourth").isCapped()); assert.soon(function() { return s.getDB(baseName).getCollection("fourth").isCapped(); }); +rt.stop(); diff --git a/jstests/master_slave/repl9.js b/jstests/master_slave/repl9.js index e612698da03..b39a65b8bc4 100644 --- a/jstests/master_slave/repl9.js +++ b/jstests/master_slave/repl9.js @@ -58,3 +58,4 @@ assert.soon(function() { assert.soon(function() { return -1 == s.getDB(first).getCollectionNames().indexOf("one"); }); +rt.stop(); diff --git a/jstests/master_slave/snapshot1.js b/jstests/master_slave/snapshot1.js index 8db8e232e3b..1cb0033f6d1 100644 --- a/jstests/master_slave/snapshot1.js +++ b/jstests/master_slave/snapshot1.js @@ -43,3 +43,5 @@ assert.soon(function() { }); assert(!rawMongoProgramOutput().match(/resync/)); +rt1.stop(); +rt2.stop(); diff --git a/jstests/multiVersion/initialize_from_old_node.js b/jstests/multiVersion/initialize_from_old_node.js index 79aaafb6a4e..0335ec9bf56 100644 --- a/jstests/multiVersion/initialize_from_old_node.js +++ b/jstests/multiVersion/initialize_from_old_node.js @@ -18,5 +18,8 @@ var oldNode = conns[0]; var config = rst.getReplSetConfig(); var response = oldNode.getDB("admin").runCommand({replSetInitiate: config}); - assert.eq(response.ok, 1); + assert.commandWorked(response); + // Wait for secondaries to finish their initial sync before shutting down the cluster. + rst.awaitSecondaryNodes(); + rst.stopSet(); })(); diff --git a/jstests/multiVersion/mixed_storage_version_replication.js b/jstests/multiVersion/mixed_storage_version_replication.js index c431247ad46..da0a4309bcc 100644 --- a/jstests/multiVersion/mixed_storage_version_replication.js +++ b/jstests/multiVersion/mixed_storage_version_replication.js @@ -710,4 +710,5 @@ function doMultiThreadedWork(primary, numThreads) { print("Work done, checking to see all nodes match"); assertSameData(primary, replTest.nodes); } + replTest.stopSet(); })(); diff --git a/jstests/multiVersion/readmode_compatibility.js b/jstests/multiVersion/readmode_compatibility.js index cd3ffcf3b4c..5434a4d59ae 100644 --- a/jstests/multiVersion/readmode_compatibility.js +++ b/jstests/multiVersion/readmode_compatibility.js @@ -38,4 +38,5 @@ assert.neq(connLatest, null, 'unable to start 3.2 mongod'); connLatest.forceReadMode('compatibility'); assert.eq('commands', connLatest.readMode()); + MongoRunner.stopMongod(connLatest); })(); diff --git a/jstests/multiVersion/remove_feature_compatibility_version.js b/jstests/multiVersion/remove_feature_compatibility_version.js index 6e1448d5f5e..7c73d2847a1 100644 --- a/jstests/multiVersion/remove_feature_compatibility_version.js +++ b/jstests/multiVersion/remove_feature_compatibility_version.js @@ -15,4 +15,5 @@ {renameCollection: 'admin.system.version', to: 'admin.dummy.collection'}), ErrorCodes.IllegalOperation); assert.writeErrorWithCode(adminDB.system.version.remove({}), 40670); + MongoRunner.stopMongod(standalone); })(); diff --git a/jstests/noPassthrough/after_cluster_time.js b/jstests/noPassthrough/after_cluster_time.js index 64317ed9458..9bcf4598ecb 100644 --- a/jstests/noPassthrough/after_cluster_time.js +++ b/jstests/noPassthrough/after_cluster_time.js @@ -68,4 +68,5 @@ ErrorCodes.InvalidOptions, "expected afterClusterTime fail in serverStatus"); + rst.stopSet(); }()); diff --git a/jstests/noPassthrough/agg_explain_read_concern.js b/jstests/noPassthrough/agg_explain_read_concern.js index 4e2f6ec4333..c3178d20c49 100644 --- a/jstests/noPassthrough/agg_explain_read_concern.js +++ b/jstests/noPassthrough/agg_explain_read_concern.js @@ -52,4 +52,6 @@ expectedErrStr = "Command does not support non local"; assert.neq(cmdRes.errmsg.indexOf(expectedErrStr), -1, tojson(cmdRes)); }); + + rst.stopSet(); }()); diff --git a/jstests/noPassthrough/aggregation_zero_batchsize.js b/jstests/noPassthrough/aggregation_zero_batchsize.js index 5ffd097c7da..3360c6d0856 100644 --- a/jstests/noPassthrough/aggregation_zero_batchsize.js +++ b/jstests/noPassthrough/aggregation_zero_batchsize.js @@ -83,4 +83,6 @@ assert.throws(() => cursor.itcount(), [], "expected getMore to fail"); assertNumOpenCursors(0); + + MongoRunner.stopMongod(conn); }()); diff --git a/jstests/noPassthrough/apply_ops_mode.js b/jstests/noPassthrough/apply_ops_mode.js index f9bfb5a0017..bd21665cef1 100644 --- a/jstests/noPassthrough/apply_ops_mode.js +++ b/jstests/noPassthrough/apply_ops_mode.js @@ -89,4 +89,5 @@ applyOps: [collModOp], })); + MongoRunner.stopMongod(standalone); })(); diff --git a/jstests/noPassthrough/apply_ops_overwrite_admin_system_version.js b/jstests/noPassthrough/apply_ops_overwrite_admin_system_version.js index e767f4b01ce..33dd8afd219 100644 --- a/jstests/noPassthrough/apply_ops_overwrite_admin_system_version.js +++ b/jstests/noPassthrough/apply_ops_overwrite_admin_system_version.js @@ -36,4 +36,5 @@ assert.eq(1, res.cursor.firstBatch.length); assert.eq(newUUID, res.cursor.firstBatch[0].info.uuid); + MongoRunner.stopMongod(standalone); })(); diff --git a/jstests/noPassthrough/atomic_rename_collection.js b/jstests/noPassthrough/atomic_rename_collection.js index d63e08ff6ce..6efc9362a5f 100644 --- a/jstests/noPassthrough/atomic_rename_collection.js +++ b/jstests/noPassthrough/atomic_rename_collection.js @@ -42,4 +42,5 @@ "renameCollection was supposed to only generate " + test.expectedOplogEntries + " oplog entries: " + tojson(ops)); }); + rs.stopSet(); })(); diff --git a/jstests/noPassthrough/auth_reject_mismatching_logical_times.js b/jstests/noPassthrough/auth_reject_mismatching_logical_times.js index 56c2695bdd8..c19d7b36887 100644 --- a/jstests/noPassthrough/auth_reject_mismatching_logical_times.js +++ b/jstests/noPassthrough/auth_reject_mismatching_logical_times.js @@ -68,4 +68,5 @@ assertAcceptsValidLogicalTime(st.configRS.getPrimary().getDB("admin")); st.stop(); + rst.stopSet(); })(); diff --git a/jstests/noPassthrough/change_streams_require_majority_read_concern.js b/jstests/noPassthrough/change_streams_require_majority_read_concern.js index 40ada0d5231..e7e43fe0de8 100644 --- a/jstests/noPassthrough/change_streams_require_majority_read_concern.js +++ b/jstests/noPassthrough/change_streams_require_majority_read_concern.js @@ -112,4 +112,5 @@ let doc = getOneDoc(cursor); assert.docEq(doc.operationType, "insert"); assert.docEq(doc.fullDocument, {_id: 2}); + rst.stopSet(); }()); diff --git a/jstests/noPassthrough/coll_mod_apply_ops.js b/jstests/noPassthrough/coll_mod_apply_ops.js index 5755e1ddf30..d5e1cc7e4e7 100644 --- a/jstests/noPassthrough/coll_mod_apply_ops.js +++ b/jstests/noPassthrough/coll_mod_apply_ops.js @@ -40,4 +40,5 @@ // Ensure the collection options of the existing collection were not affected. assert.eq(dbCollMod.getCollectionInfos()[0].name, collName); assert.eq(dbCollMod.getCollectionInfos()[0].options.validationLevel, "off"); + MongoRunner.stopMongod(conn); }()); diff --git a/jstests/noPassthrough/collation_clone_collection.js b/jstests/noPassthrough/collation_clone_collection.js index bac97b1b8f3..538b49d2077 100644 --- a/jstests/noPassthrough/collation_clone_collection.js +++ b/jstests/noPassthrough/collation_clone_collection.js @@ -71,4 +71,6 @@ for (var i = 0; i < sourceIndexInfos.length; ++i) { assert.contains(sourceIndexInfos[i], destIndexInfos); } + MongoRunner.stopMongod(source); + MongoRunner.stopMongod(dest); })(); diff --git a/jstests/noPassthrough/command_line_parsing.js b/jstests/noPassthrough/command_line_parsing.js index ed41d3b7ff7..bd1b1ff0e8b 100644 --- a/jstests/noPassthrough/command_line_parsing.js +++ b/jstests/noPassthrough/command_line_parsing.js @@ -8,6 +8,7 @@ m.getDB(baseName).getCollection(baseName).save({a: 1}); assert.throws(function() { m.getDB(baseName).getCollection(baseName).find({a: 1}).toArray(); }); +MongoRunner.stopMongod(m); // test config file var m2 = MongoRunner.runMongod({config: "jstests/libs/testconfig"}); @@ -23,6 +24,7 @@ var m2expected = { } }; var m2result = m2.getDB("admin").runCommand("getCmdLineOpts"); +MongoRunner.stopMongod(m2); // remove variables that depend on the way the test is started. delete m2result.parsed.net.serviceExecutor; @@ -49,6 +51,7 @@ var m3expected = { } }; var m3result = m3.getDB("admin").runCommand("getCmdLineOpts"); +MongoRunner.stopMongod(m3); // remove variables that depend on the way the test is started. delete m3result.parsed.net.serviceExecutor; diff --git a/jstests/noPassthrough/commands_handle_kill.js b/jstests/noPassthrough/commands_handle_kill.js index ebeb024d44e..42e73ec8e56 100644 --- a/jstests/noPassthrough/commands_handle_kill.js +++ b/jstests/noPassthrough/commands_handle_kill.js @@ -196,4 +196,5 @@ if (${ canYield }) { assertCommandPropogatesPlanExecutorKillReason( {delete: coll.getName(), deletes: [{q: {}, limit: 0}]}, {curOpFilter: {op: 'remove'}}); + MongoRunner.stopMongod(mongod); })(); diff --git a/jstests/noPassthrough/copydb_illegal_collections.js b/jstests/noPassthrough/copydb_illegal_collections.js index cbce5abecaf..1cfe3c933db 100644 --- a/jstests/noPassthrough/copydb_illegal_collections.js +++ b/jstests/noPassthrough/copydb_illegal_collections.js @@ -18,4 +18,5 @@ assert.commandFailedWithCode(res, ErrorCodes.InvalidNamespace); assert.gt(res["errmsg"].indexOf("cannot write to 'db2.system.replset'"), -1); rst.awaitReplication(); + rst.stopSet(); })(); diff --git a/jstests/noPassthrough/currentop_includes_await_time.js b/jstests/noPassthrough/currentop_includes_await_time.js index 7a68dbe6f70..0c34999a512 100644 --- a/jstests/noPassthrough/currentop_includes_await_time.js +++ b/jstests/noPassthrough/currentop_includes_await_time.js @@ -44,4 +44,5 @@ assert.writeOK(coll.insert({_id: 2})); cleanupShell(); + MongoRunner.stopMongod(conn); }()); diff --git a/jstests/noPassthrough/currentop_query.js b/jstests/noPassthrough/currentop_query.js index 7adb23d3a1c..3dbde751fe4 100644 --- a/jstests/noPassthrough/currentop_query.js +++ b/jstests/noPassthrough/currentop_query.js @@ -505,6 +505,7 @@ }); delete TestData.queryFilter; + MongoRunner.stopMongod(conn); } function currentOpCommand(inputDB, filter) { diff --git a/jstests/noPassthrough/exit_logging.js b/jstests/noPassthrough/exit_logging.js index 1dee8c347db..67f73eb2ed9 100644 --- a/jstests/noPassthrough/exit_logging.js +++ b/jstests/noPassthrough/exit_logging.js @@ -109,6 +109,7 @@ }; runAllTests(mongosLauncher); + st.stop(); }()); }()); diff --git a/jstests/noPassthrough/ftdc_setparam.js b/jstests/noPassthrough/ftdc_setparam.js index d4cf4029426..4e9b2459311 100644 --- a/jstests/noPassthrough/ftdc_setparam.js +++ b/jstests/noPassthrough/ftdc_setparam.js @@ -15,4 +15,5 @@ } assert.eq(getparam("diagnosticDataCollectionPeriodMillis"), 101); + MongoRunner.stopMongod(m); })(); diff --git a/jstests/noPassthrough/global_operation_latency_histogram.js b/jstests/noPassthrough/global_operation_latency_histogram.js index 056d4ce2618..b531fc7ce6c 100644 --- a/jstests/noPassthrough/global_operation_latency_histogram.js +++ b/jstests/noPassthrough/global_operation_latency_histogram.js @@ -165,4 +165,5 @@ // Test non-command. assert.commandFailed(testColl.runCommand("IHopeNobodyEverMakesThisACommand")); lastHistogram = checkHistogramDiff(0, 0, 1); + MongoRunner.stopMongod(mongo); }()); diff --git a/jstests/noPassthrough/hostname_bind_ips.js b/jstests/noPassthrough/hostname_bind_ips.js index 57ee1698ff5..531fac1ac77 100644 --- a/jstests/noPassthrough/hostname_bind_ips.js +++ b/jstests/noPassthrough/hostname_bind_ips.js @@ -13,4 +13,5 @@ } return true; }, "Cannot connect to 127.0.0.1 when bound to localhost", 20000); + MongoRunner.stopMongod(proc); })(); diff --git a/jstests/noPassthrough/index_killop.js b/jstests/noPassthrough/index_killop.js index 4908ea5ded9..6694b24bab5 100644 --- a/jstests/noPassthrough/index_killop.js +++ b/jstests/noPassthrough/index_killop.js @@ -66,4 +66,5 @@ testAbortIndexBuild({background: true}); testAbortIndexBuild({background: false}); + MongoRunner.stopMongod(conn); })(); diff --git a/jstests/noPassthrough/index_partial_no_explain_cmds.js b/jstests/noPassthrough/index_partial_no_explain_cmds.js index 69af783c1a9..5083ab2881e 100644 --- a/jstests/noPassthrough/index_partial_no_explain_cmds.js +++ b/jstests/noPassthrough/index_partial_no_explain_cmds.js @@ -53,4 +53,5 @@ // operations to fail if they have no query predicate. ret = coll.distinct("x"); assert.eq(2, ret.length); + MongoRunner.stopMongod(runner); })(); diff --git a/jstests/noPassthrough/index_version_v2.js b/jstests/noPassthrough/index_version_v2.js index e84f206394a..b3fe65841d3 100644 --- a/jstests/noPassthrough/index_version_v2.js +++ b/jstests/noPassthrough/index_version_v2.js @@ -120,4 +120,5 @@ // Test that attempting to create an index with v=3 returns an error. assert.commandFailed(testDB.index_version.createIndex({withV3: 1}, {v: 3})); + MongoRunner.stopMongod(conn); })(); diff --git a/jstests/noPassthrough/latency_includes_lock_acquisition_time.js b/jstests/noPassthrough/latency_includes_lock_acquisition_time.js index a20caf1af06..ad0c6856a1c 100644 --- a/jstests/noPassthrough/latency_includes_lock_acquisition_time.js +++ b/jstests/noPassthrough/latency_includes_lock_acquisition_time.js @@ -150,4 +150,5 @@ conn.forceWriteMode("compatibility"); conn.forceReadMode("legacy"); runTests(); + MongoRunner.stopMongod(conn); }()); diff --git a/jstests/noPassthrough/log_find_getmore.js b/jstests/noPassthrough/log_find_getmore.js index 21a40f89257..a2b3d911f3f 100644 --- a/jstests/noPassthrough/log_find_getmore.js +++ b/jstests/noPassthrough/log_find_getmore.js @@ -166,4 +166,5 @@ ]; assertLogLineContains(conn, logLine); + MongoRunner.stopMongod(conn); })(); diff --git a/jstests/noPassthrough/loglong.js b/jstests/noPassthrough/loglong.js index aed04bd4e4d..86e152d44ac 100644 --- a/jstests/noPassthrough/loglong.js +++ b/jstests/noPassthrough/loglong.js @@ -50,4 +50,5 @@ assert(found, tojson(log)); } -})();
\ No newline at end of file + MongoRunner.stopMongod(conn); +})(); diff --git a/jstests/noPassthrough/low_js_heap_limit.js b/jstests/noPassthrough/low_js_heap_limit.js index 68c28a232a4..4f4245df6f6 100644 --- a/jstests/noPassthrough/low_js_heap_limit.js +++ b/jstests/noPassthrough/low_js_heap_limit.js @@ -13,4 +13,5 @@ var returnCode = runProgram("mongo", "--jsHeapLimitMB=1", "--nodb", "--eval='exit();'"); assert.eq(returnCode, 1); + MongoRunner.stopMongod(conn); }()); diff --git a/jstests/noPassthrough/partial_unique_indexes.js b/jstests/noPassthrough/partial_unique_indexes.js index 7c376872ade..2928790c65f 100644 --- a/jstests/noPassthrough/partial_unique_indexes.js +++ b/jstests/noPassthrough/partial_unique_indexes.js @@ -44,4 +44,5 @@ testDB.adminCommand({configureFailPoint: 'WTWriteConflictExceptionForReads', mode: "off"})); res = t.validate(); assert(res.valid, tojson(res)); + MongoRunner.stopMongod(conn); })(); diff --git a/jstests/noPassthrough/query_yield_reset_timer.js b/jstests/noPassthrough/query_yield_reset_timer.js index 1ecb4ec7b60..3bdb81730f7 100644 --- a/jstests/noPassthrough/query_yield_reset_timer.js +++ b/jstests/noPassthrough/query_yield_reset_timer.js @@ -41,4 +41,5 @@ // result set to be returned in a single batch. assert.gt(explainRes.executionStats.executionStages.saveState, 4 / 2, tojson(explainRes)); assert.lt(explainRes.executionStats.executionStages.saveState, 4 * 2, tojson(explainRes)); + MongoRunner.stopMongod(mongod); })(); diff --git a/jstests/noPassthrough/refresh_logical_session_cache_now.js b/jstests/noPassthrough/refresh_logical_session_cache_now.js index 6d10cbca451..294a16043d2 100644 --- a/jstests/noPassthrough/refresh_logical_session_cache_now.js +++ b/jstests/noPassthrough/refresh_logical_session_cache_now.js @@ -41,5 +41,5 @@ assert.eq( config.system.sessions.count(), numSessions + 1, "should have written session records"); - + MongoRunner.stopMongod(conn); }()); diff --git a/jstests/noPassthrough/repl_write_threads_start_param.js b/jstests/noPassthrough/repl_write_threads_start_param.js index f3a0556a43b..232fc75fe2b 100644 --- a/jstests/noPassthrough/repl_write_threads_start_param.js +++ b/jstests/noPassthrough/repl_write_threads_start_param.js @@ -35,4 +35,5 @@ // setParameter to ensure it is not possible assert.commandFailed( mongo.getDB("admin").runCommand({setParameter: 1, replWriterThreadCount: 1})); + MongoRunner.stopMongod(mongo); }()); diff --git a/jstests/noPassthrough/sessions_collection_auto_healing.js b/jstests/noPassthrough/sessions_collection_auto_healing.js index 9e2e2df3dc6..58c64561161 100644 --- a/jstests/noPassthrough/sessions_collection_auto_healing.js +++ b/jstests/noPassthrough/sessions_collection_auto_healing.js @@ -30,4 +30,5 @@ load('jstests/libs/sessions_collection.js'); validateSessionsCollection(conn, true, true); } + MongoRunner.stopMongod(conn); })(); diff --git a/jstests/noPassthrough/skip_sharding_configuration_checks.js b/jstests/noPassthrough/skip_sharding_configuration_checks.js index 2f1ecfbe3f7..2dc096faf8e 100644 --- a/jstests/noPassthrough/skip_sharding_configuration_checks.js +++ b/jstests/noPassthrough/skip_sharding_configuration_checks.js @@ -49,4 +49,5 @@ shardRS.startSet({}, true); expectState(shardRS, ReplSetTest.State.PRIMARY); shardRS.stopSet(); + MongoRunner.stopMongos(st.s); })(); diff --git a/jstests/noPassthrough/system_indexes.js b/jstests/noPassthrough/system_indexes.js index 3fa784e97da..a85ac0b3f6c 100644 --- a/jstests/noPassthrough/system_indexes.js +++ b/jstests/noPassthrough/system_indexes.js @@ -78,5 +78,6 @@ conn = MongoRunner.runMongod({restart: conn, cleanData: false}); db = conn.getDB("admin"); assert.eq(2, db.system.roles.getIndexes().length); + MongoRunner.stopMongod(conn); })(); diff --git a/jstests/noPassthrough/ttl_partial_index.js b/jstests/noPassthrough/ttl_partial_index.js index 3da3a8a1513..d818f86d28d 100644 --- a/jstests/noPassthrough/ttl_partial_index.js +++ b/jstests/noPassthrough/ttl_partial_index.js @@ -27,4 +27,5 @@ "Wrong number of documents in partial index, after TTL monitor run"); assert.eq( 1, coll.find().itcount(), "Wrong number of documents in collection, after TTL monitor run"); + MongoRunner.stopMongod(runner); })(); diff --git a/jstests/noPassthrough/unix_socket.js b/jstests/noPassthrough/unix_socket.js index dcdb7d049a5..5b31ff4ccad 100644 --- a/jstests/noPassthrough/unix_socket.js +++ b/jstests/noPassthrough/unix_socket.js @@ -15,6 +15,10 @@ return; } + // Do not fail if this test leaves unterminated processes because testSockOptions + // is expected to throw before it calls stopMongod. + TestData.failIfUnterminatedProcesses = false; + var doesLogMatchRegex = function(logArray, regex) { for (let i = (logArray.length - 1); i >= 0; i--) { var regexInLine = regex.exec(logArray[i]); diff --git a/jstests/noPassthrough/unsupported_change_stream_deployments.js b/jstests/noPassthrough/unsupported_change_stream_deployments.js index 90b494654e8..0f5ea72768f 100644 --- a/jstests/noPassthrough/unsupported_change_stream_deployments.js +++ b/jstests/noPassthrough/unsupported_change_stream_deployments.js @@ -39,6 +39,7 @@ assert.soonNoExcept(() => checkFCV(slave.getDB("admin"), "3.6") || true); assert.soonNoExcept(() => slave.getDB("test").ensure_db_exists.exists()); assertChangeStreamNotSupportedOnConnection(slave); + masterSlaveFixture.stop(); // Test a sharded cluster with standalone shards. const clusterWithStandalones = new ShardingTest( @@ -55,4 +56,5 @@ mongosDB.adminCommand({shardCollection: "test.ensure_db_exists", key: {_id: "hashed"}})); assertChangeStreamNotSupportedOnConnection(clusterWithStandalones.shard0); assertChangeStreamNotSupportedOnConnection(clusterWithStandalones.shard1); + clusterWithStandalones.stop(); }()); diff --git a/jstests/noPassthrough/update_yield1.js b/jstests/noPassthrough/update_yield1.js index 0c1f9f16376..1670f5d13bb 100644 --- a/jstests/noPassthrough/update_yield1.js +++ b/jstests/noPassthrough/update_yield1.js @@ -42,4 +42,5 @@ // A multi-update shouldn't yield if it has $isolated. assert.writeOK(coll.update({$isolated: true}, {$inc: {counter: 1}}, {multi: true})); assert.eq(countUpdateYields(coll), 0, 'yielded during $isolated multi-update'); + MongoRunner.stopMongod(mongod); })(); diff --git a/jstests/noPassthrough/wt_delayed_secondary_read_concern_majority.js b/jstests/noPassthrough/wt_delayed_secondary_read_concern_majority.js index d6125231cbb..2eed8b1e336 100644 --- a/jstests/noPassthrough/wt_delayed_secondary_read_concern_majority.js +++ b/jstests/noPassthrough/wt_delayed_secondary_read_concern_majority.js @@ -10,6 +10,9 @@ (function() { "use strict"; + // Skip db hash check because delayed secondary will not catch up to primary. + TestData.skipCheckDBHashes = true; + // Skip this test if not running with the "wiredTiger" storage engine. var storageEngine = jsTest.options().storageEngine || "wiredTiger"; if (storageEngine !== "wiredTiger") { @@ -57,5 +60,6 @@ } assert.writeOK(batch.execute()); } + rst.stopSet(); } })(); diff --git a/jstests/noPassthrough/yield_group.js b/jstests/noPassthrough/yield_group.js index 4eb40623e19..4304f326bb7 100644 --- a/jstests/noPassthrough/yield_group.js +++ b/jstests/noPassthrough/yield_group.js @@ -29,4 +29,5 @@ coll.explain('executionStats').group({key: {_id: 1}, reduce: function() {}, initial: {}}); var numYields = explain.executionStats.executionStages.saveState; assert.gt(numYields, (nDocsToInsert / worksPerYield) - 2, tojson(explain)); + MongoRunner.stopMongod(conn); })(); diff --git a/jstests/noPassthroughWithMongod/clonecollection.js b/jstests/noPassthroughWithMongod/clonecollection.js index 2c7cf24ea9a..9bcd168ed11 100644 --- a/jstests/noPassthroughWithMongod/clonecollection.js +++ b/jstests/noPassthroughWithMongod/clonecollection.js @@ -64,3 +64,5 @@ assert.commandWorked(f.createView("viewA", "a", [])); assert.commandFailedWithCode(t.cloneCollection("localhost:" + fromMongod.port, "viewA"), ErrorCodes.CommandNotSupportedOnView, "cloneCollection on view expected to fail"); +MongoRunner.stopMongod(fromMongod); +MongoRunner.stopMongod(toMongod); diff --git a/jstests/noPassthroughWithMongod/host_connection_string_validation.js b/jstests/noPassthroughWithMongod/host_connection_string_validation.js index f7bac51db88..b4cc778b3a5 100644 --- a/jstests/noPassthroughWithMongod/host_connection_string_validation.js +++ b/jstests/noPassthroughWithMongod/host_connection_string_validation.js @@ -25,6 +25,7 @@ var exitCode = _runMongoProgram.apply(null, args); jsTest.log("Inner mode test finished, exit code was " + exitCode); + MongoRunner.stopMongod(mongod); // Pass the inner test's exit code back as the outer test's exit code if (exitCode != 0) { doassert("inner test failed with exit code " + exitcode); diff --git a/jstests/noPassthroughWithMongod/indexbg_interrupts.js b/jstests/noPassthroughWithMongod/indexbg_interrupts.js index 3e0601a9bce..a1d5bc848b8 100644 --- a/jstests/noPassthroughWithMongod/indexbg_interrupts.js +++ b/jstests/noPassthroughWithMongod/indexbg_interrupts.js @@ -99,3 +99,4 @@ for (var idx = 0; idx < dropAction.length; idx++) { }, "secondary did not drop index for " + dc.toString()); } jsTest.log("indexbg-interrupts.js done"); +replTest.stopSet(); diff --git a/jstests/noPassthroughWithMongod/indexbg_restart_secondary.js b/jstests/noPassthroughWithMongod/indexbg_restart_secondary.js index 26b8083de75..03963fdb223 100644 --- a/jstests/noPassthroughWithMongod/indexbg_restart_secondary.js +++ b/jstests/noPassthroughWithMongod/indexbg_restart_secondary.js @@ -75,4 +75,5 @@ assert.soon(function() { return 2 == secondDB.getCollection(collectionName).getIndexes().length; }, "Index build not resumed after restart", 30000, 50); + replTest.stopSet(); }()); diff --git a/jstests/noPassthroughWithMongod/ipv6_connection_string_validation.js b/jstests/noPassthroughWithMongod/ipv6_connection_string_validation.js index 6d80b2aec70..5014ab3fc60 100644 --- a/jstests/noPassthroughWithMongod/ipv6_connection_string_validation.js +++ b/jstests/noPassthroughWithMongod/ipv6_connection_string_validation.js @@ -32,6 +32,7 @@ if (exitCode != 0) { doassert("inner test failed with exit code " + exitcode); } + MongoRunner.stopMongod(mongod); return; } diff --git a/jstests/noPassthroughWithMongod/mr_noscripting.js b/jstests/noPassthroughWithMongod/mr_noscripting.js index 7a6ca1555a8..59d16e37627 100644 --- a/jstests/noPassthroughWithMongod/mr_noscripting.js +++ b/jstests/noPassthroughWithMongod/mr_noscripting.js @@ -19,3 +19,4 @@ assert.eq(0, mrResult.ok, 'mr result: ' + tojson(mrResult)); // Confirm that mongod did not crash var cmdResult = testDB.adminCommand({serverStatus: 1}); assert(cmdResult.ok, 'serverStatus failed, result: ' + tojson(cmdResult)); +MongoRunner.stopMongod(conn); diff --git a/jstests/noPassthroughWithMongod/newcollection2.js b/jstests/noPassthroughWithMongod/newcollection2.js index 46cd1316c90..dd5522e2456 100644 --- a/jstests/noPassthroughWithMongod/newcollection2.js +++ b/jstests/noPassthroughWithMongod/newcollection2.js @@ -15,3 +15,4 @@ assert(v.valid); db.runCommand({applyOps: [{op: 'u', ns: 'a\0b'}]}); var res = db["a\0a"].insert({}); assert(res.hasWriteError(), "A write to collection a\0a succceeded"); +MongoRunner.stopMongod(m); diff --git a/jstests/noPassthroughWithMongod/replset_host_connection_validation.js b/jstests/noPassthroughWithMongod/replset_host_connection_validation.js index e65387dd705..10c3af2b460 100644 --- a/jstests/noPassthroughWithMongod/replset_host_connection_validation.js +++ b/jstests/noPassthroughWithMongod/replset_host_connection_validation.js @@ -25,6 +25,7 @@ const exitCode = _runMongoProgram(...args); jsTest.log("Inner mode test finished, exit code was " + exitCode); + replTest.stopSet(); // Pass the inner test's exit code back as the outer test's exit code if (exitCode != 0) { doassert("inner test failed with exit code " + exitCode); diff --git a/jstests/noPassthroughWithMongod/server7428.js b/jstests/noPassthroughWithMongod/server7428.js index 745f11021f4..7b5278a10e1 100644 --- a/jstests/noPassthroughWithMongod/server7428.js +++ b/jstests/noPassthroughWithMongod/server7428.js @@ -19,4 +19,6 @@ admin.copyDatabase('test', 'test', fromDb.host); + MongoRunner.stopMongod(fromDb); + MongoRunner.stopMongod(toDb); })(); diff --git a/jstests/parallel/repl.js b/jstests/parallel/repl.js index 314cd4df335..0158224926d 100644 --- a/jstests/parallel/repl.js +++ b/jstests/parallel/repl.js @@ -59,3 +59,4 @@ assert.soon(function() { // printjson( sh ); return mh.md5 == sh.md5; }); +rt.stop(); diff --git a/jstests/replsets/apply_ops_create_indexes.js b/jstests/replsets/apply_ops_create_indexes.js index 8a9e5303916..4fe813b5ed4 100644 --- a/jstests/replsets/apply_ops_create_indexes.js +++ b/jstests/replsets/apply_ops_create_indexes.js @@ -97,4 +97,6 @@ localDB = rst.getPrimary().getDB("local"); ensureOplogEntryExists(localDB, insertFormatIndexName); + + rst.stopSet(); }()); diff --git a/jstests/replsets/apply_ops_create_view.js b/jstests/replsets/apply_ops_create_view.js index 4554ea2dc76..0aac71ee490 100644 --- a/jstests/replsets/apply_ops_create_view.js +++ b/jstests/replsets/apply_ops_create_view.js @@ -14,4 +14,6 @@ const cmd = {applyOps: [{op: "c", ns: db + ".$cmd", o: {create: "foo", viewOn: "bar"}}]}; assert.commandWorked(db.runCommand(cmd), tojson(cmd)); assert.eq(db.foo.findOne({a: 1}).b, "hi"); + + replTest.stopSet(); }()); diff --git a/jstests/replsets/apply_ops_create_with_uuid.js b/jstests/replsets/apply_ops_create_with_uuid.js index 3628d6700f2..d3f69fc2a71 100644 --- a/jstests/replsets/apply_ops_create_with_uuid.js +++ b/jstests/replsets/apply_ops_create_with_uuid.js @@ -47,4 +47,5 @@ assert.eq(db.getCollectionInfos({name: "foo"}).length, 0, "expected foo collection to no longer exist"); + replTest.stopSet(); }()); diff --git a/jstests/replsets/apply_ops_idempotency.js b/jstests/replsets/apply_ops_idempotency.js index 3a2f6d4f3d7..7173bbd0301 100644 --- a/jstests/replsets/apply_ops_idempotency.js +++ b/jstests/replsets/apply_ops_idempotency.js @@ -194,4 +194,6 @@ for (let f in tests) testIdempotency(rst.getPrimary(), tests[f], f); + + rst.stopSet(); })(); diff --git a/jstests/replsets/apply_ops_wc.js b/jstests/replsets/apply_ops_wc.js index f44993705f9..793a9f43e99 100644 --- a/jstests/replsets/apply_ops_wc.js +++ b/jstests/replsets/apply_ops_wc.js @@ -135,4 +135,5 @@ secondaries[0].getDB('admin').runCommand({configureFailPoint: 'rsSyncApplyStop', mode: 'off'}); secondaries[1].getDB('admin').runCommand({configureFailPoint: 'rsSyncApplyStop', mode: 'off'}); + replTest.stopSet(); })(); diff --git a/jstests/replsets/auth1.js b/jstests/replsets/auth1.js index 9ab12cc7157..211beb9016e 100644 --- a/jstests/replsets/auth1.js +++ b/jstests/replsets/auth1.js @@ -207,4 +207,6 @@ load("jstests/replsets/rslib.js"); } return true; }); + MongoRunner.stopMongod(conn); + rs.stopSet(); })(); diff --git a/jstests/replsets/catchup.js b/jstests/replsets/catchup.js index c58dde887c0..82d542e9bbd 100644 --- a/jstests/replsets/catchup.js +++ b/jstests/replsets/catchup.js @@ -206,4 +206,5 @@ rst.awaitReplication(); checkOpInOplog(steppedDownPrimary, stepUpResults.latestOpOnOldPrimary, 1); + rst.stopSet(); })(); diff --git a/jstests/replsets/catchup_takeover_two_nodes_ahead.js b/jstests/replsets/catchup_takeover_two_nodes_ahead.js index 2c0fd0eb5fa..f4a59cb567b 100644 --- a/jstests/replsets/catchup_takeover_two_nodes_ahead.js +++ b/jstests/replsets/catchup_takeover_two_nodes_ahead.js @@ -56,4 +56,5 @@ replSet.waitForState(2, ReplSetTest.State.SECONDARY, replSet.kDefaultTimeoutMS); // Let the nodes catchup. restartServerReplication(nodes.slice(1, 5)); + replSet.stopSet(); })(); diff --git a/jstests/replsets/collate_id.js b/jstests/replsets/collate_id.js index 73a34c22433..6e6d56bc67d 100644 --- a/jstests/replsets/collate_id.js +++ b/jstests/replsets/collate_id.js @@ -62,4 +62,5 @@ secondaryDB.adminCommand({configureFailPoint: "rsSyncApplyStop", mode: "off"})); replTest.awaitReplication(); assert.eq(0, secondaryColl.find().itcount()); + replTest.stopSet(); })(); diff --git a/jstests/replsets/commands_that_write_accept_wc.js b/jstests/replsets/commands_that_write_accept_wc.js index 08af483b93a..b2dd90d2886 100644 --- a/jstests/replsets/commands_that_write_accept_wc.js +++ b/jstests/replsets/commands_that_write_accept_wc.js @@ -148,4 +148,5 @@ load('jstests/libs/write_concern_util.js'); testInvalidWriteConcern(cmd); }); + replTest.stopSet(); })(); diff --git a/jstests/replsets/copydb.js b/jstests/replsets/copydb.js index 2746035f6ef..e63f6e4b393 100644 --- a/jstests/replsets/copydb.js +++ b/jstests/replsets/copydb.js @@ -93,4 +93,5 @@ assert.eq(primaryTargetDB.foo.getIndexes().length, secondaryTargetDB.foo.getIndexes().length, 'incorrect number of indexes in target collection on secondary after copy'); + replTest.stopSet(); }()); diff --git a/jstests/replsets/dbhash_system_collections.js b/jstests/replsets/dbhash_system_collections.js index c55156a4992..c60532dfe1c 100644 --- a/jstests/replsets/dbhash_system_collections.js +++ b/jstests/replsets/dbhash_system_collections.js @@ -51,4 +51,5 @@ var primaryMd5 = checkDbHash(primary); var secondaryMd5 = checkDbHash(secondary); assert.eq(primaryMd5, secondaryMd5, 'dbhash is different on the primary and the secondary'); + rst.stopSet(); })(); diff --git a/jstests/replsets/double_rollback.js b/jstests/replsets/double_rollback.js index fe2eaccf165..9faf66263a4 100644 --- a/jstests/replsets/double_rollback.js +++ b/jstests/replsets/double_rollback.js @@ -143,5 +143,5 @@ // Verify data consistency between nodes. rst.checkReplicatedDataHashes(); rst.checkOplogs(); - + rst.stopSet(); }()); diff --git a/jstests/replsets/drain.js b/jstests/replsets/drain.js index 1f60713a6a6..41e8d475f83 100644 --- a/jstests/replsets/drain.js +++ b/jstests/replsets/drain.js @@ -106,4 +106,5 @@ // secondary and we cannot guarantee all writes reached the secondary's op queue prior to // shutting down the original primary. assert.gte(primary.getDB("foo").foo.find().itcount(), 2); + replSet.stopSet(); })(); diff --git a/jstests/replsets/drop_oplog.js b/jstests/replsets/drop_oplog.js index 8e2a7c2e1d2..2ba8dc44c72 100644 --- a/jstests/replsets/drop_oplog.js +++ b/jstests/replsets/drop_oplog.js @@ -32,5 +32,5 @@ renameOutput = localDB.foo.renameCollection("oplog.rs"); assert.eq(renameOutput.ok, 0); assert.eq(renameOutput.errmsg, "can't rename to live oplog while replicating"); - + rt.stopSet(); }()); diff --git a/jstests/replsets/election_id.js b/jstests/replsets/election_id.js index ff079ca1172..c6259020003 100644 --- a/jstests/replsets/election_id.js +++ b/jstests/replsets/election_id.js @@ -96,5 +96,6 @@ load("jstests/replsets/rslib.js"); var newElectionId = res.repl.electionId; assert.lt(oldElectionId.valueOf(), newElectionId.valueOf()); oldElectionId = newElectionId; + rst.stopSet(); })(); diff --git a/jstests/replsets/emptycapped.js b/jstests/replsets/emptycapped.js index 39a5c0eac56..c6b08fff9dc 100644 --- a/jstests/replsets/emptycapped.js +++ b/jstests/replsets/emptycapped.js @@ -92,4 +92,5 @@ {create: "view1", viewOn: "collection", pipeline: [{$match: {}}]})); assert.commandFailedWithCode(primaryTestDB.runCommand({emptycapped: "system.views"}), ErrorCodes.IllegalOperation); + rst.stopSet(); })(); diff --git a/jstests/replsets/explain_slaveok.js b/jstests/replsets/explain_slaveok.js index 8cd715af648..68eda89bce7 100644 --- a/jstests/replsets/explain_slaveok.js +++ b/jstests/replsets/explain_slaveok.js @@ -151,3 +151,4 @@ explainOut = secondary.getDB("test").runCommand({ verbosity: "executionStats" }); assert.commandFailed(explainOut, "explain write op on secondary, slaveOk true"); +replTest.stopSet(); diff --git a/jstests/replsets/get_replication_info_helper.js b/jstests/replsets/get_replication_info_helper.js index cd6ef7d8a10..920b729f636 100644 --- a/jstests/replsets/get_replication_info_helper.js +++ b/jstests/replsets/get_replication_info_helper.js @@ -51,5 +51,5 @@ assert.soon(function() { return rawMongoProgramOutput().match("behind the freshest"); }); - + replSet.stopSet(); })(); diff --git a/jstests/replsets/index_delete.js b/jstests/replsets/index_delete.js index c89a3d47348..5f64979dbc3 100644 --- a/jstests/replsets/index_delete.js +++ b/jstests/replsets/index_delete.js @@ -121,3 +121,5 @@ assert.soon(function() { return 1 == secondDB[collName].getIndexes().length; }, "Indexes not dropped on secondary"); assert.eq(1, secondDB[collName].getIndexes().length); + +replTest.stopSet(); diff --git a/jstests/replsets/index_restart_secondary.js b/jstests/replsets/index_restart_secondary.js index be328ede8bc..0b391d5f8e2 100644 --- a/jstests/replsets/index_restart_secondary.js +++ b/jstests/replsets/index_restart_secondary.js @@ -75,3 +75,5 @@ if (conns[0].getDB('test').serverBuildInfo().bits !== 32) { jsTest.log("index-restart-secondary.js complete"); } + +replTest.stopSet(); diff --git a/jstests/replsets/initial_sync4.js b/jstests/replsets/initial_sync4.js index e0ff50af4a2..89b5f42f39a 100644 --- a/jstests/replsets/initial_sync4.js +++ b/jstests/replsets/initial_sync4.js @@ -81,6 +81,6 @@ assert.eq(mc.getIndexKeys().length, sc.getIndexKeys().length); assert.eq(mc.find().sort({x: 1}).itcount(), sc.find().sort({x: 1}).itcount()); - + MongoRunner.stopMongod(s); replTest.stopSet(15); -}());
\ No newline at end of file +}()); diff --git a/jstests/replsets/initial_sync_applier_error.js b/jstests/replsets/initial_sync_applier_error.js index 7a280242024..36182e58c39 100644 --- a/jstests/replsets/initial_sync_applier_error.js +++ b/jstests/replsets/initial_sync_applier_error.js @@ -52,4 +52,5 @@ assert.eq(0, secondary.getDB('test').getCollection(name).count()); assert.eq(1, secondary.getDB('test').getCollection(newCollName).count()); assert.eq("hi", secondary.getDB('test').getCollection(newCollName).findOne({_id: 0}).content); + replSet.stopSet(); })(); diff --git a/jstests/replsets/initial_sync_capped_index.js b/jstests/replsets/initial_sync_capped_index.js index 2100b6f14bc..66895864d03 100644 --- a/jstests/replsets/initial_sync_capped_index.js +++ b/jstests/replsets/initial_sync_capped_index.js @@ -122,5 +122,5 @@ var failMsg = "Index validation of '" + secondaryCappedColl.name + "' failed: " + tojson(validate_result); assert(validate_result.valid, failMsg); - + replTest.stopSet(); })(); diff --git a/jstests/replsets/initial_sync_move_forward.js b/jstests/replsets/initial_sync_move_forward.js index 410b1eb707a..17f12a881d0 100644 --- a/jstests/replsets/initial_sync_move_forward.js +++ b/jstests/replsets/initial_sync_move_forward.js @@ -95,4 +95,5 @@ var indexSpec = GetIndexHelpers.findByKeyPattern(secondaryColl.getIndexes(), {x: 1}); assert.neq(null, indexSpec); assert.eq(true, indexSpec.unique); -})();
\ No newline at end of file + rst.stopSet(); +})(); diff --git a/jstests/replsets/initial_sync_oplog_rollover.js b/jstests/replsets/initial_sync_oplog_rollover.js index 95c93566f12..1ffdc6220c2 100644 --- a/jstests/replsets/initial_sync_oplog_rollover.js +++ b/jstests/replsets/initial_sync_oplog_rollover.js @@ -62,4 +62,5 @@ assert.eq(0, secondary.getDB('local')['temp_oplog_buffer'].find().itcount(), "Oplog buffer was not dropped after initial sync"); + replSet.stopSet(); })(); diff --git a/jstests/replsets/initial_sync_replSetGetStatus.js b/jstests/replsets/initial_sync_replSetGetStatus.js index 5d8398b5802..abb5e5c563f 100644 --- a/jstests/replsets/initial_sync_replSetGetStatus.js +++ b/jstests/replsets/initial_sync_replSetGetStatus.js @@ -87,4 +87,5 @@ assert.eq(0, secondary.getDB('local')['temp_oplog_buffer'].find().itcount(), "Oplog buffer was not dropped after initial sync"); + replSet.stopSet(); })(); diff --git a/jstests/replsets/initiate_replset_on_downgraded_standalone_node.js b/jstests/replsets/initiate_replset_on_downgraded_standalone_node.js index 9593c69c1cf..309a9cfd207 100644 --- a/jstests/replsets/initiate_replset_on_downgraded_standalone_node.js +++ b/jstests/replsets/initiate_replset_on_downgraded_standalone_node.js @@ -37,4 +37,5 @@ // Check an arbitrary collection's uuid field. assert.eq(undefined, getUUIDFromListCollections(conn.getDB("local"), "startup_log")); + MongoRunner.stopMongod(conn); }()); diff --git a/jstests/replsets/last_op_visible.js b/jstests/replsets/last_op_visible.js index f5a50596ea4..99b081d8a26 100644 --- a/jstests/replsets/last_op_visible.js +++ b/jstests/replsets/last_op_visible.js @@ -52,5 +52,5 @@ load("jstests/replsets/rslib.js"); {"$replData": 1}); assert.commandWorked(res.commandReply); assert.eq(last_op_visible, res.metadata["$replData"].lastOpVisible); - + replTest.stopSet(); }()); diff --git a/jstests/replsets/lastop.js b/jstests/replsets/lastop.js index e1bf6c6fbd4..497afa1c9c5 100644 --- a/jstests/replsets/lastop.js +++ b/jstests/replsets/lastop.js @@ -130,5 +130,5 @@ m1.getCollection("test.foo").update({m1: 1}, {$set: {m1: 4}}); noOp = m1.getCollection("test.foo").getDB().getLastErrorObj().lastOp; assert.eq(noOp, fifthteenthOp); - + replTest.stopSet(); })(); diff --git a/jstests/replsets/linearizable_read_concern.js b/jstests/replsets/linearizable_read_concern.js index 80c435aaccb..da544cc9e55 100644 --- a/jstests/replsets/linearizable_read_concern.js +++ b/jstests/replsets/linearizable_read_concern.js @@ -122,4 +122,5 @@ load('jstests/libs/write_concern_util.js'); print('replSetStepDown did not throw exception but returned: ' + tojson(result)); }); parallelShell(); + replTest.stopSet(); }()); diff --git a/jstests/replsets/maintenance.js b/jstests/replsets/maintenance.js index 8b4765212b8..77934123e68 100644 --- a/jstests/replsets/maintenance.js +++ b/jstests/replsets/maintenance.js @@ -93,3 +93,4 @@ result = conns[1].getDB("admin").runCommand({replSetMaintenance: 0}); assert.eq(result.ok, 1, tojson(result)); secondarySoon(); +replTest.stopSet(); diff --git a/jstests/replsets/maintenance_non-blocking.js b/jstests/replsets/maintenance_non-blocking.js index 4606bcc1985..5581ffe3546 100644 --- a/jstests/replsets/maintenance_non-blocking.js +++ b/jstests/replsets/maintenance_non-blocking.js @@ -41,6 +41,7 @@ doTest = function() { print("******* fsyncUnlock'n secondary ************* "); sDB.fsyncUnlock(); + replTest.stopSet(); }; doTest(); diff --git a/jstests/replsets/no_chaining.js b/jstests/replsets/no_chaining.js index 07a67c3ea2b..8aea02776eb 100644 --- a/jstests/replsets/no_chaining.js +++ b/jstests/replsets/no_chaining.js @@ -60,3 +60,5 @@ if (!_isWindows()) { var config = master.getDB("local").system.replset.findOne(); assert.eq(false, config.settings.chainingAllowed, tojson(config)); } + +replTest.stopSet(); diff --git a/jstests/replsets/noop_writes_wait_for_write_concern.js b/jstests/replsets/noop_writes_wait_for_write_concern.js index 61ffc518df4..455a99f1456 100644 --- a/jstests/replsets/noop_writes_wait_for_write_concern.js +++ b/jstests/replsets/noop_writes_wait_for_write_concern.js @@ -232,4 +232,5 @@ testCommandWithWriteConcern(cmd); }); -})();
\ No newline at end of file + replTest.stopSet(); +})(); diff --git a/jstests/replsets/oplog_term.js b/jstests/replsets/oplog_term.js index 76ba6babfa7..70339e0d523 100644 --- a/jstests/replsets/oplog_term.js +++ b/jstests/replsets/oplog_term.js @@ -53,4 +53,6 @@ assert.eq(status.term, oplogEntry.t, 'term in oplog entry does not match term in status: ' + tojson(oplogEntry)); + + replSet.stopSet(); })(); diff --git a/jstests/replsets/oplog_wallclock.js b/jstests/replsets/oplog_wallclock.js index bedb27e95e0..b11b125923b 100644 --- a/jstests/replsets/oplog_wallclock.js +++ b/jstests/replsets/oplog_wallclock.js @@ -26,4 +26,5 @@ assert.writeOK(collection.remove({_id: 1})); assertLastOplogHasWT(primary, 'remove'); + replSet.stopSet(); })(); diff --git a/jstests/replsets/pipelineout.js b/jstests/replsets/pipelineout.js index 44441e63d5c..8849a356b02 100644 --- a/jstests/replsets/pipelineout.js +++ b/jstests/replsets/pipelineout.js @@ -30,3 +30,5 @@ assert.throws(function() { primary.coll.aggregate({$out: "out"}).itcount(); replTest.awaitReplication(); assert.eq(primary.out.find().sort({x: 1}).toArray(), secondary.out.find().sort({x: 1}).toArray()); + +replTest.stopSet(); diff --git a/jstests/replsets/plan_cache_slaveok.js b/jstests/replsets/plan_cache_slaveok.js index 2de5749f086..1703620a0d5 100644 --- a/jstests/replsets/plan_cache_slaveok.js +++ b/jstests/replsets/plan_cache_slaveok.js @@ -70,3 +70,5 @@ assertPlanCacheCommandsFail(secondary.getDB("test")); // With slave ok true, the commands should succeed on the secondary. secondary.getDB("test").getMongo().setSlaveOk(true); assertPlanCacheCommandsSucceed(secondary.getDB("test")); + +replTest.stopSet(); diff --git a/jstests/replsets/priority_takeover_cascading_priorities.js b/jstests/replsets/priority_takeover_cascading_priorities.js index e210d250f10..f55997aa5c2 100644 --- a/jstests/replsets/priority_takeover_cascading_priorities.js +++ b/jstests/replsets/priority_takeover_cascading_priorities.js @@ -32,4 +32,5 @@ replSet.waitForState(2, ReplSetTest.State.PRIMARY); // Cannot stop any more nodes because we will not have a majority. + replSet.stopSet(); })(); diff --git a/jstests/replsets/priority_takeover_one_node_higher_priority.js b/jstests/replsets/priority_takeover_one_node_higher_priority.js index 3059ea2cd00..b4385cc2376 100644 --- a/jstests/replsets/priority_takeover_one_node_higher_priority.js +++ b/jstests/replsets/priority_takeover_one_node_higher_priority.js @@ -42,4 +42,5 @@ // Eventually node 0 will stand for election again because it has a higher priorty. replSet.waitForState(replSet.nodes[0], ReplSetTest.State.PRIMARY); + replSet.stopSet(); })(); diff --git a/jstests/replsets/priority_takeover_two_nodes_equal_priority.js b/jstests/replsets/priority_takeover_two_nodes_equal_priority.js index 10f31796b2a..e05805b1e96 100644 --- a/jstests/replsets/priority_takeover_two_nodes_equal_priority.js +++ b/jstests/replsets/priority_takeover_two_nodes_equal_priority.js @@ -52,5 +52,6 @@ load('jstests/replsets/rslib.js'); jsTestLog("Waiting for the other high priority node to become PRIMARY."); var expectedNewPrimary = replTest.nodes[expectedNewPrimaryIndex]; replTest.waitForState(expectedNewPrimary, ReplSetTest.State.PRIMARY); + replTest.stopSet(); })(); diff --git a/jstests/replsets/protocol_version_upgrade_downgrade.js b/jstests/replsets/protocol_version_upgrade_downgrade.js index 06bd26f2d94..8233babe999 100644 --- a/jstests/replsets/protocol_version_upgrade_downgrade.js +++ b/jstests/replsets/protocol_version_upgrade_downgrade.js @@ -88,5 +88,6 @@ load("jstests/replsets/rslib.js"); res = primary.adminCommand({replSetGetStatus: 1}); assert.commandWorked(res); assert.eq(res.members[0].optime.ts, null); + rst.stopSet(); })(); diff --git a/jstests/replsets/read_committed.js b/jstests/replsets/read_committed.js index 22424ce020a..899778dd7b5 100644 --- a/jstests/replsets/read_committed.js +++ b/jstests/replsets/read_committed.js @@ -172,4 +172,5 @@ load("jstests/replsets/rslib.js"); // For startSetIfSupportsReadMajority. assert.eq(doCommittedRead(secondaryColl), test.expectedAfter); } } + replTest.stopSet(); }()); diff --git a/jstests/replsets/read_committed_after_rollback.js b/jstests/replsets/read_committed_after_rollback.js index 9276449b488..68a80b7bdda 100644 --- a/jstests/replsets/read_committed_after_rollback.js +++ b/jstests/replsets/read_committed_after_rollback.js @@ -150,4 +150,5 @@ load("jstests/replsets/rslib.js"); // For startSetIfSupportsReadMajority. // Verify data consistency between nodes. replTest.checkReplicatedDataHashes(); replTest.checkOplogs(); + replTest.stopSet(); }()); diff --git a/jstests/replsets/read_committed_lookup.js b/jstests/replsets/read_committed_lookup.js index 7e7f1f47ae3..1f4ea4452f9 100644 --- a/jstests/replsets/read_committed_lookup.js +++ b/jstests/replsets/read_committed_lookup.js @@ -41,4 +41,5 @@ load("jstests/libs/read_committed_lib.js"); // For testReadCommittedLookup testReadCommittedLookup(rst.getPrimary().getDB("test"), shardSecondary, rst); + rst.stopSet(); })(); diff --git a/jstests/replsets/read_committed_no_snapshots.js b/jstests/replsets/read_committed_no_snapshots.js index 120129f3a57..ce83b2e2247 100644 --- a/jstests/replsets/read_committed_no_snapshots.js +++ b/jstests/replsets/read_committed_no_snapshots.js @@ -80,4 +80,5 @@ load("jstests/replsets/rslib.js"); // For reconfig and startSetIfSupportsReadMa // Ensure maxTimeMS times out while waiting for this snapshot assert.commandFailed(primary.getSiblingDB(name).foo.runCommand( 'find', {"readConcern": {"level": "majority"}, "maxTimeMS": 1000})); + replTest.stopSet(); })(); diff --git a/jstests/replsets/read_committed_with_catalog_changes.js b/jstests/replsets/read_committed_with_catalog_changes.js index 8a48593ec3b..00a73c72161 100644 --- a/jstests/replsets/read_committed_with_catalog_changes.js +++ b/jstests/replsets/read_committed_with_catalog_changes.js @@ -349,4 +349,6 @@ load("jstests/replsets/rslib.js"); // For startSetIfSupportsReadMajority. threads.forEach(thread => thread.join()); } } + + replTest.stopSet(); }()); diff --git a/jstests/replsets/rename_collection_temp.js b/jstests/replsets/rename_collection_temp.js index 3add505a4f6..c52808b14fd 100644 --- a/jstests/replsets/rename_collection_temp.js +++ b/jstests/replsets/rename_collection_temp.js @@ -75,4 +75,6 @@ replTest.awaitReplication(); checkCollectionTemp(secondaryFoo, "permanentColl", false); + + replTest.stopSet(); }()); diff --git a/jstests/replsets/replset6.js b/jstests/replsets/replset6.js index 4afd7268bf7..c0419f3c4db 100644 --- a/jstests/replsets/replset6.js +++ b/jstests/replsets/replset6.js @@ -65,3 +65,4 @@ assert.eq(1, s.getDB(second).two.findOne().a); // Make sure the source collection no longer exists. assert.eq(-1, s.getDB(first).getCollectionNames().indexOf("one")); +rt.stopSet(); diff --git a/jstests/replsets/replset8.js b/jstests/replsets/replset8.js index 8027ce72a2b..23169a2ff6a 100644 --- a/jstests/replsets/replset8.js +++ b/jstests/replsets/replset8.js @@ -82,4 +82,5 @@ slave.getDB('d')['c'].count() + ')'); jsTestLog("finished"); + rt.stopSet(); })(); diff --git a/jstests/replsets/replsetprio1.js b/jstests/replsets/replsetprio1.js index 7ee42a18a64..dc2d5295e4e 100644 --- a/jstests/replsets/replsetprio1.js +++ b/jstests/replsets/replsetprio1.js @@ -51,4 +51,5 @@ assert(master.getDB("foo").bar.findOne({i: i}) != null, 'checking ' + i); assert(master.getDB("bar").baz.findOne({i: i}) != null, 'checking ' + i); } + replTest.stopSet(); }()); diff --git a/jstests/replsets/replsetrestart1.js b/jstests/replsets/replsetrestart1.js index 870cdcfe233..388de3e1b71 100644 --- a/jstests/replsets/replsetrestart1.js +++ b/jstests/replsets/replsetrestart1.js @@ -66,4 +66,5 @@ replTest.awaitSecondaryNodes(); var config2 = master.getDB("local").system.replset.findOne(); compare_configs(config1, config2); + replTest.stopSet(); }()); diff --git a/jstests/replsets/replsets_killop.js b/jstests/replsets/replsets_killop.js index 7d31f313633..4e41046f8c8 100644 --- a/jstests/replsets/replsets_killop.js +++ b/jstests/replsets/replsets_killop.js @@ -68,3 +68,4 @@ function allReplicated() { // Wait for the correct number of (replicated) documents to be present on the secondary. assert.soon(allReplicated, "didn't replicate all docs", 5 * 60 * 1000); +replTest.stopSet(); diff --git a/jstests/replsets/request_primary_stepdown.js b/jstests/replsets/request_primary_stepdown.js index b9997e03a23..2b95377a153 100644 --- a/jstests/replsets/request_primary_stepdown.js +++ b/jstests/replsets/request_primary_stepdown.js @@ -41,5 +41,5 @@ assert.eq(logContents.indexOf("stepdown period must be longer than secondaryCatchUpPeriodSecs"), -1, "_requestRemotePrimaryStepDown sent an invalid replSetStepDown command"); - + replSet.stopSet(); })(); diff --git a/jstests/replsets/restore_term.js b/jstests/replsets/restore_term.js index b5bb7b013bd..a303d92d0db 100644 --- a/jstests/replsets/restore_term.js +++ b/jstests/replsets/restore_term.js @@ -64,4 +64,5 @@ load("jstests/replsets/rslib.js"); // After restart, the new primary stands up with the newer term. assert.gte(getCurrentTerm(primary), firstSuccessfulTerm + 1); + rst.stopSet(); })(); diff --git a/jstests/replsets/rollback_with_socket_error_then_steady_state.js b/jstests/replsets/rollback_with_socket_error_then_steady_state.js index 98dfc368f7e..48aac9a91b3 100644 --- a/jstests/replsets/rollback_with_socket_error_then_steady_state.js +++ b/jstests/replsets/rollback_with_socket_error_then_steady_state.js @@ -136,5 +136,6 @@ // Verify data consistency between nodes. rst.checkReplicatedDataHashes(); rst.checkOplogs(); + rst.stopSet(); }()); diff --git a/jstests/replsets/single_server_majority.js b/jstests/replsets/single_server_majority.js index c36f021c989..2b70d05280a 100644 --- a/jstests/replsets/single_server_majority.js +++ b/jstests/replsets/single_server_majority.js @@ -9,4 +9,5 @@ col = db.getCollection("single_server_majority"); col.drop(); // see if we can get a majority write on this single server -assert.writeOK(col.save({a: "test"}, {writeConcern: {w: 'majority'}}));
\ No newline at end of file +assert.writeOK(col.save({a: "test"}, {writeConcern: {w: 'majority'}})); +MongoRunner.stopMongod(mongod); diff --git a/jstests/replsets/startParallelShell.js b/jstests/replsets/startParallelShell.js index b04e4abf2f3..0027c5600e3 100644 --- a/jstests/replsets/startParallelShell.js +++ b/jstests/replsets/startParallelShell.js @@ -32,4 +32,5 @@ var db; return db.coll0.find({test: "explicit port"}).count() === 1; }); awaitShell(); + replSet.stopSet(); })(); diff --git a/jstests/replsets/step_down_during_draining.js b/jstests/replsets/step_down_during_draining.js index 0ea89a27275..03f6a29d58f 100644 --- a/jstests/replsets/step_down_during_draining.js +++ b/jstests/replsets/step_down_during_draining.js @@ -130,4 +130,5 @@ load("jstests/replsets/rslib.js"); // Check that all writes reached the secondary's op queue prior to // stepping down the original primary and got applied. assert.eq(secondary.getDB("foo").foo.find().itcount(), numDocuments); + replSet.stopSet(); })(); diff --git a/jstests/replsets/step_down_during_draining2.js b/jstests/replsets/step_down_during_draining2.js index 611a80872bb..2d91910fbca 100644 --- a/jstests/replsets/step_down_during_draining2.js +++ b/jstests/replsets/step_down_during_draining2.js @@ -170,4 +170,5 @@ assert.writeOK(secondary.getDB("foo").flag.insert({sentinel: 1}, {writeConcern: {w: 3}})); // Check that no writes were lost. assert.eq(secondary.getDB("foo").foo.find().itcount(), numDocuments); + replSet.stopSet(); })(); diff --git a/jstests/replsets/step_down_during_draining3.js b/jstests/replsets/step_down_during_draining3.js index a9148eb5b44..b62e288e6d8 100644 --- a/jstests/replsets/step_down_during_draining3.js +++ b/jstests/replsets/step_down_during_draining3.js @@ -126,4 +126,5 @@ assert.soon(function() { return secondary.getDB("foo").foo.find().itcount() == numDocuments; }); + replSet.stopSet(); })(); diff --git a/jstests/replsets/stepdown_kill_other_ops.js b/jstests/replsets/stepdown_kill_other_ops.js index a1e7e49c380..2974ef3624e 100644 --- a/jstests/replsets/stepdown_kill_other_ops.js +++ b/jstests/replsets/stepdown_kill_other_ops.js @@ -70,4 +70,5 @@ var exitCode = evalRunner({checkExitSuccess: false}); assert.neq( 0, exitCode, "expected shell to exit abnormally due to JS execution being terminated"); + replSet.stopSet(); })(); diff --git a/jstests/replsets/stepdown_killop.js b/jstests/replsets/stepdown_killop.js index 3ef89adc6fa..bd8fd10cb5b 100644 --- a/jstests/replsets/stepdown_killop.js +++ b/jstests/replsets/stepdown_killop.js @@ -78,4 +78,5 @@ assert.writeOK(primary.getDB(name).foo.remove({})); restartServerReplication(secondary); + replSet.stopSet(); })(); diff --git a/jstests/replsets/stepdown_long_wait_time.js b/jstests/replsets/stepdown_long_wait_time.js index c7c6306cf11..f38a6add12f 100644 --- a/jstests/replsets/stepdown_long_wait_time.js +++ b/jstests/replsets/stepdown_long_wait_time.js @@ -72,4 +72,5 @@ jsTestLog("Wait for SECONDARY " + secondary.host + " to become PRIMARY"); replSet.waitForState(secondary, ReplSetTest.State.PRIMARY); + replSet.stopSet(); })(); diff --git a/jstests/replsets/stepup.js b/jstests/replsets/stepup.js index 0e89fc25252..f50e6d2d8ab 100644 --- a/jstests/replsets/stepup.js +++ b/jstests/replsets/stepup.js @@ -56,4 +56,5 @@ load("jstests/replsets/rslib.js"); // Make sure the step up succeeded. assert.eq(secondary, rst.getPrimary()); + rst.stopSet(); })(); diff --git a/jstests/replsets/sync_passive.js b/jstests/replsets/sync_passive.js index 321a198e9af..d1d18bb79a8 100644 --- a/jstests/replsets/sync_passive.js +++ b/jstests/replsets/sync_passive.js @@ -79,3 +79,5 @@ replTest.awaitReplication(); print("bring #1 back up, make sure everything's okay"); replTest.restart(1); + +replTest.stopSet(); diff --git a/jstests/replsets/system_profile.js b/jstests/replsets/system_profile.js index ae524df1c75..7e1250da6dd 100644 --- a/jstests/replsets/system_profile.js +++ b/jstests/replsets/system_profile.js @@ -45,4 +45,5 @@ assert.eq( op, getLatestOp(), "oplog entry created when system.profile was emptied via emptycapped"); assert(primaryDB.system.profile.drop()); + rst.stopSet(); })(); diff --git a/jstests/replsets/system_profile_secondary.js b/jstests/replsets/system_profile_secondary.js index 69ab259f191..7c62e126323 100644 --- a/jstests/replsets/system_profile_secondary.js +++ b/jstests/replsets/system_profile_secondary.js @@ -22,4 +22,5 @@ jsTestLog('Check the query is in the profile and turn profiling off.'); assert.eq(numProfileEntries(secondaryDB.doesntexist), 1, 'expected a single profile entry'); assert.commandWorked(secondaryDB.runCommand({profile: 0})); + rst.stopSet(); })(); diff --git a/jstests/replsets/test_command.js b/jstests/replsets/test_command.js index abaf10bc56d..cc4ef0f0d0f 100644 --- a/jstests/replsets/test_command.js +++ b/jstests/replsets/test_command.js @@ -141,4 +141,5 @@ waitForDrainFinish: 0, }), 'node 1' + primary.host + ' failed to wait for drain to finish'); + replSet.stopSet(); })(); diff --git a/jstests/replsets/user_management_wc.js b/jstests/replsets/user_management_wc.js index 1b28112c541..c8ac612b597 100644 --- a/jstests/replsets/user_management_wc.js +++ b/jstests/replsets/user_management_wc.js @@ -160,4 +160,5 @@ load('jstests/multiVersion/libs/auth_helpers.js'); testInvalidWriteConcern(cmd); }); + replTest.stopSet(); })(); diff --git a/jstests/sharding/addshard2.js b/jstests/sharding/addshard2.js index e0fce8864ec..cb61d4b4245 100644 --- a/jstests/sharding/addshard2.js +++ b/jstests/sharding/addshard2.js @@ -194,5 +194,6 @@ rst5.stopSet(); st.stop(); + MongoRunner.stopMongod(normalShard); })(); diff --git a/jstests/sharding/addshard4.js b/jstests/sharding/addshard4.js index de2c8a17c10..4d4ee82975d 100644 --- a/jstests/sharding/addshard4.js +++ b/jstests/sharding/addshard4.js @@ -36,6 +36,7 @@ printjson(result); assert.eq(result, true); + r.stopSet(); r = new ReplSetTest({name: "addshard42", nodes: 3}); r.startSet(); @@ -57,5 +58,6 @@ assert.eq(result, true); s.stop(); + r.stopSet(); })(); diff --git a/jstests/sharding/addshard5.js b/jstests/sharding/addshard5.js index 128c52252a1..f2e6068d023 100644 --- a/jstests/sharding/addshard5.js +++ b/jstests/sharding/addshard5.js @@ -42,4 +42,5 @@ assert.eq('world', shard2.getCollection(coll + '').findOne().hello); st.stop(); + MongoRunner.stopMongod(shard2); })(); diff --git a/jstests/sharding/addshard_idempotent.js b/jstests/sharding/addshard_idempotent.js index e0d98e9ea18..796869d2cd0 100644 --- a/jstests/sharding/addshard_idempotent.js +++ b/jstests/sharding/addshard_idempotent.js @@ -50,7 +50,8 @@ assert.eq(shard2.getURL(), shard.host); } } - + MongoRunner.stopMongod(shard1); + shard2.stopSet(); st.stop(); })(); diff --git a/jstests/sharding/after_cluster_time.js b/jstests/sharding/after_cluster_time.js index bc8b1cf462a..2c647b4d423 100644 --- a/jstests/sharding/after_cluster_time.js +++ b/jstests/sharding/after_cluster_time.js @@ -117,5 +117,6 @@ assertAfterClusterTimeReadFailsWithCode( testDB, {level: "majority", afterClusterTime: Timestamp(0, 0)}, ErrorCodes.InvalidOptions); + rst.stopSet(); st.stop(); })(); diff --git a/jstests/sharding/aggregation_currentop.js b/jstests/sharding/aggregation_currentop.js index 395888f7e0c..f90994412d9 100644 --- a/jstests/sharding/aggregation_currentop.js +++ b/jstests/sharding/aggregation_currentop.js @@ -531,6 +531,9 @@ // Test that the allUsers parameter is ignored when authentication is disabled. restartReplSet(shardRS, {shardsvr: null, keyFile: null}); + // Explicitly set the keyFile to null. If ReplSetTest#stopSet sees a keyFile property, it + // attempts to auth before dbhash checks. + shardRS.keyFile = null; // Ensure that there is at least one other connection present. const otherConn = new Mongo(shardConn.host); @@ -613,4 +616,5 @@ assert.commandWorked(shardAdminDB.killOp(op.opid)); awaitShell(); + st.stop(); })(); diff --git a/jstests/sharding/auth.js b/jstests/sharding/auth.js index 8a87be3e68f..6306eb13857 100644 --- a/jstests/sharding/auth.js +++ b/jstests/sharding/auth.js @@ -345,5 +345,6 @@ assert.commandFailed(readOnlyDB.killOp(123)); s.stop(); - + d1.stopSet(); + d2.stopSet(); })(); diff --git a/jstests/sharding/auth_copydb.js b/jstests/sharding/auth_copydb.js index 6c30e847f8a..6ee68b84bd8 100644 --- a/jstests/sharding/auth_copydb.js +++ b/jstests/sharding/auth_copydb.js @@ -41,4 +41,5 @@ assert.eq(1, destTestDB.foo.findOne().a); st.stop(); + MongoRunner.stopMongod(sourceMongodConn); })(); diff --git a/jstests/sharding/auth_no_config_primary.js b/jstests/sharding/auth_no_config_primary.js index 5d79df932a5..e06527c738b 100644 --- a/jstests/sharding/auth_no_config_primary.js +++ b/jstests/sharding/auth_no_config_primary.js @@ -52,4 +52,5 @@ TestData.skipCheckDBHashes = true; assert.eq('world', res.hello); st.stop(); + MongoRunner.stopMongos(otherMongos); })(); diff --git a/jstests/sharding/authmr.js b/jstests/sharding/authmr.js index fb5b5a94486..82f0b40b2fc 100644 --- a/jstests/sharding/authmr.js +++ b/jstests/sharding/authmr.js @@ -108,4 +108,5 @@ } }()); + cluster.stop(); })(); diff --git a/jstests/sharding/authwhere.js b/jstests/sharding/authwhere.js index a47dc5fb601..71a62c896c0 100644 --- a/jstests/sharding/authwhere.js +++ b/jstests/sharding/authwhere.js @@ -81,4 +81,5 @@ } }()); + cluster.stop(); })(); diff --git a/jstests/sharding/autodiscover_config_rs_from_secondary.js b/jstests/sharding/autodiscover_config_rs_from_secondary.js index a3e2c115004..6726b7f9ac1 100644 --- a/jstests/sharding/autodiscover_config_rs_from_secondary.js +++ b/jstests/sharding/autodiscover_config_rs_from_secondary.js @@ -47,4 +47,6 @@ var admin = mongos.getDB('admin'); mongos.setSlaveOk(true); assert.eq(1, admin.foo.findOne().a); + MongoRunner.stopMongos(mongos); + rst.stopSet(); })(); diff --git a/jstests/sharding/causal_consistency_shell_support.js b/jstests/sharding/causal_consistency_shell_support.js index 13d0f53b3c3..fab5da53e21 100644 --- a/jstests/sharding/causal_consistency_shell_support.js +++ b/jstests/sharding/causal_consistency_shell_support.js @@ -194,5 +194,6 @@ ErrorCodes.InvalidOptions + ", because the afterClusterTime value, " + invalidTime + ", should not be ahead of the clusterTime, " + session.getClusterTime().clusterTime); + rst.stopSet(); st.stop(); })(); diff --git a/jstests/sharding/change_streams.js b/jstests/sharding/change_streams.js index 3cb35d318bb..404b73c72ef 100644 --- a/jstests/sharding/change_streams.js +++ b/jstests/sharding/change_streams.js @@ -167,5 +167,5 @@ pipeline: [{$changeStream: {resumeAfter: resumeToken}}], expectedCode: 40615 }); - + st.stop(); })(); diff --git a/jstests/sharding/change_streams_shards_start_in_sync.js b/jstests/sharding/change_streams_shards_start_in_sync.js index 3a32146f0d8..3ed7d3fe98a 100644 --- a/jstests/sharding/change_streams_shards_start_in_sync.js +++ b/jstests/sharding/change_streams_shards_start_in_sync.js @@ -109,4 +109,5 @@ assert.writeOK(mongosColl.insert({_id: -1002}, {writeConcern: {w: "majority"}})); waitForShell(); + st.stop(); })(); diff --git a/jstests/sharding/cleanup_orphaned_basic.js b/jstests/sharding/cleanup_orphaned_basic.js index cd23a4f9507..66fe7924157 100644 --- a/jstests/sharding/cleanup_orphaned_basic.js +++ b/jstests/sharding/cleanup_orphaned_basic.js @@ -117,5 +117,6 @@ {cleanupOrphaned: coll2.getFullName(), startingFromKey: {a: 'someValue', c: 1}})); st.stop(); + MongoRunner.stopMongod(mongod); })(); diff --git a/jstests/sharding/cleanup_orphaned_cmd_during_movechunk.js b/jstests/sharding/cleanup_orphaned_cmd_during_movechunk.js index bf8471b2e98..6341dbb887d 100644 --- a/jstests/sharding/cleanup_orphaned_cmd_during_movechunk.js +++ b/jstests/sharding/cleanup_orphaned_cmd_during_movechunk.js @@ -153,5 +153,6 @@ load('./jstests/libs/cleanup_orphaned_util.js'); assert.eq(31, coll.count()); st.stop(); + MongoRunner.stopMongod(staticMongod); })(); diff --git a/jstests/sharding/cleanup_orphaned_cmd_during_movechunk_hashed.js b/jstests/sharding/cleanup_orphaned_cmd_during_movechunk_hashed.js index 1468fb79f1e..8fb97e4aa1a 100644 --- a/jstests/sharding/cleanup_orphaned_cmd_during_movechunk_hashed.js +++ b/jstests/sharding/cleanup_orphaned_cmd_during_movechunk_hashed.js @@ -123,6 +123,7 @@ load('./jstests/libs/cleanup_orphaned_util.js'); assert.eq(1, recipColl.count()); assert.eq(1, coll.count()); + MongoRunner.stopMongod(staticMongod); st.stop(); })(); diff --git a/jstests/sharding/commands_that_write_accept_wc_configRS.js b/jstests/sharding/commands_that_write_accept_wc_configRS.js index ac4932f290b..fc57249c80c 100644 --- a/jstests/sharding/commands_that_write_accept_wc_configRS.js +++ b/jstests/sharding/commands_that_write_accept_wc_configRS.js @@ -306,4 +306,5 @@ load('jstests/multiVersion/libs/auth_helpers.js'); testMajorityWriteConcern(cmd); }); + st.stop(); })(); diff --git a/jstests/sharding/commands_that_write_accept_wc_shards.js b/jstests/sharding/commands_that_write_accept_wc_shards.js index 4ea13819064..5dc01f69905 100644 --- a/jstests/sharding/commands_that_write_accept_wc_shards.js +++ b/jstests/sharding/commands_that_write_accept_wc_shards.js @@ -397,4 +397,6 @@ load('jstests/libs/write_concern_util.js'); testValidWriteConcern(cmd); testInvalidWriteConcern(cmd); }); + + st.stop(); })(); diff --git a/jstests/sharding/config_rs_no_primary.js b/jstests/sharding/config_rs_no_primary.js index fee859a994e..92196425263 100644 --- a/jstests/sharding/config_rs_no_primary.js +++ b/jstests/sharding/config_rs_no_primary.js @@ -56,4 +56,5 @@ TestData.skipCheckingUUIDsConsistentAcrossCluster = true; testOps(st.s); st.stop(); + MongoRunner.stopMongos(mongos2); }()); diff --git a/jstests/sharding/config_version_rollback.js b/jstests/sharding/config_version_rollback.js index 0f70a641ea1..95bc6be936a 100644 --- a/jstests/sharding/config_version_rollback.js +++ b/jstests/sharding/config_version_rollback.js @@ -169,5 +169,7 @@ shardIdentityDoc.clusterId, "oldPriClusterId: " + origConfigVersionDoc.clusterId); configRS.stopSet(); + MongoRunner.stopMongod(shard); + MongoRunner.stopMongos(mongos); })(); diff --git a/jstests/sharding/configsvr_metadata_commands_require_majority_write_concern.js b/jstests/sharding/configsvr_metadata_commands_require_majority_write_concern.js index f2f7dd5e53d..e03b7fbf27f 100644 --- a/jstests/sharding/configsvr_metadata_commands_require_majority_write_concern.js +++ b/jstests/sharding/configsvr_metadata_commands_require_majority_write_concern.js @@ -149,5 +149,6 @@ setupFuncs.addShard, cleanupFuncs.noop); + MongoRunner.stopMongos(newShard); st.stop(); })(); diff --git a/jstests/sharding/conn_pool_stats.js b/jstests/sharding/conn_pool_stats.js index 04952a273b6..7c248f383e6 100644 --- a/jstests/sharding/conn_pool_stats.js +++ b/jstests/sharding/conn_pool_stats.js @@ -29,4 +29,5 @@ stats["totalCreated"], tojson(stats)); } + cluster.stop(); })(); diff --git a/jstests/sharding/error_propagation.js b/jstests/sharding/error_propagation.js index ee113329138..596534bf094 100644 --- a/jstests/sharding/error_propagation.js +++ b/jstests/sharding/error_propagation.js @@ -20,4 +20,5 @@ {aggregate: 'foo', pipeline: [{$project: {total: {'$add': ['$a', 1]}}}], cursor: {}}); assert.commandFailed(res); assert.eq("$add only supports numeric or date types, not array", res.errmsg, printjson(res)); + st.stop(); }()); diff --git a/jstests/sharding/idhack_sharded.js b/jstests/sharding/idhack_sharded.js index 475014d0fa5..4767e579c75 100644 --- a/jstests/sharding/idhack_sharded.js +++ b/jstests/sharding/idhack_sharded.js @@ -32,3 +32,5 @@ assert.eq(2, coll.count()); assert.eq(1, coll.find().itcount()); assert.eq(1, coll.find({_id: 1}, {_id: 1}).itcount()); coll.remove({}); + +st.stop(); diff --git a/jstests/sharding/ismaster.js b/jstests/sharding/ismaster.js index b3500cf6009..47dff297e96 100644 --- a/jstests/sharding/ismaster.js +++ b/jstests/sharding/ismaster.js @@ -36,3 +36,4 @@ for (field in res) { } assert(badFields.length === 0, "\nthe result:\n" + tojson(res) + "\ncontained fields it shouldn't have: " + badFields); +st.stop(); diff --git a/jstests/sharding/keys_rotation_interval_sec.js b/jstests/sharding/keys_rotation_interval_sec.js index 213c95f2f87..3810e390d6a 100644 --- a/jstests/sharding/keys_rotation_interval_sec.js +++ b/jstests/sharding/keys_rotation_interval_sec.js @@ -26,4 +26,5 @@ "key document " + i + ": " + tojson(key) + "expiresAt value is greater than: " + maxExpireTime); }); + st.stop(); })(); diff --git a/jstests/sharding/kill_op_overflow.js b/jstests/sharding/kill_op_overflow.js index 0a4231f5753..2d30799b9aa 100644 --- a/jstests/sharding/kill_op_overflow.js +++ b/jstests/sharding/kill_op_overflow.js @@ -8,4 +8,5 @@ assert.commandFailed( st.s.getDB("admin").runCommand({killOp: 1, op: "shard0000:99999999999999999999999"})); + st.stop(); })(); diff --git a/jstests/sharding/listshards.js b/jstests/sharding/listshards.js index 77ecb53695d..cbde033dc94 100644 --- a/jstests/sharding/listshards.js +++ b/jstests/sharding/listshards.js @@ -64,5 +64,6 @@ rs1.stopSet(); shardTest.stop(); + MongoRunner.stopMongod(standaloneShard); })(); diff --git a/jstests/sharding/mapReduce_inSharded.js b/jstests/sharding/mapReduce_inSharded.js index 52eb379e1fd..853cdb33bad 100644 --- a/jstests/sharding/mapReduce_inSharded.js +++ b/jstests/sharding/mapReduce_inSharded.js @@ -82,4 +82,5 @@ {out: {inline: 1}, query: {str: "foo"}, collation: {locale: "en_US", strength: 2}}); assert.commandWorked(out); assert.eq(out.counts.input, 1); + st.stop(); })(); diff --git a/jstests/sharding/mapReduce_nonSharded.js b/jstests/sharding/mapReduce_nonSharded.js index 40fb098931b..ad94004a68a 100644 --- a/jstests/sharding/mapReduce_nonSharded.js +++ b/jstests/sharding/mapReduce_nonSharded.js @@ -60,3 +60,4 @@ out = db.runCommand({ out: "mrBasic" + "srcNonSharded", }); verifyOutput(out); +st.stop(); diff --git a/jstests/sharding/mapReduce_outSharded.js b/jstests/sharding/mapReduce_outSharded.js index 34cde2b63ef..90452c0c186 100644 --- a/jstests/sharding/mapReduce_outSharded.js +++ b/jstests/sharding/mapReduce_outSharded.js @@ -58,3 +58,4 @@ out = db.runCommand({ out: "mrBasic" + "srcNonSharded", }); verifyOutput(out); +st.stop(); diff --git a/jstests/sharding/migration_critical_section_concurrency.js b/jstests/sharding/migration_critical_section_concurrency.js index 2da0c983031..e51d9d5d738 100644 --- a/jstests/sharding/migration_critical_section_concurrency.js +++ b/jstests/sharding/migration_critical_section_concurrency.js @@ -64,4 +64,5 @@ load('./jstests/libs/chunk_manipulation_util.js'); joinMoveChunk(); st.stop(); + MongoRunner.stopMongod(staticMongod); })(); diff --git a/jstests/sharding/migration_ignore_interrupts_1.js b/jstests/sharding/migration_ignore_interrupts_1.js index e3dbf3a2ad2..83a77f08445 100644 --- a/jstests/sharding/migration_ignore_interrupts_1.js +++ b/jstests/sharding/migration_ignore_interrupts_1.js @@ -73,4 +73,5 @@ load('./jstests/libs/chunk_manipulation_util.js'); assert.eq(1, shard2Coll1.find().itcount()); st.stop(); + MongoRunner.stopMongod(staticMongod); })(); diff --git a/jstests/sharding/migration_ignore_interrupts_2.js b/jstests/sharding/migration_ignore_interrupts_2.js index cd09bd24365..718c6a347ff 100644 --- a/jstests/sharding/migration_ignore_interrupts_2.js +++ b/jstests/sharding/migration_ignore_interrupts_2.js @@ -53,4 +53,5 @@ load('./jstests/libs/chunk_manipulation_util.js'); assert.eq(1, shard1Coll1.find().itcount()); st.stop(); + MongoRunner.stopMongod(staticMongod); })(); diff --git a/jstests/sharding/migration_ignore_interrupts_3.js b/jstests/sharding/migration_ignore_interrupts_3.js index 4c606d357ac..13c5b15f6f9 100644 --- a/jstests/sharding/migration_ignore_interrupts_3.js +++ b/jstests/sharding/migration_ignore_interrupts_3.js @@ -104,4 +104,5 @@ load('./jstests/libs/chunk_manipulation_util.js'); assert.eq(1, shard2Coll2.find().itcount(), "shard2 failed to complete migration."); st.stop(); + MongoRunner.stopMongod(staticMongod); })(); diff --git a/jstests/sharding/migration_ignore_interrupts_4.js b/jstests/sharding/migration_ignore_interrupts_4.js index 3d943639e83..64c7b89e25e 100644 --- a/jstests/sharding/migration_ignore_interrupts_4.js +++ b/jstests/sharding/migration_ignore_interrupts_4.js @@ -105,4 +105,5 @@ load('./jstests/libs/chunk_manipulation_util.js'); assert.eq(3, shard2Coll2.find().itcount(), "shard2 failed to complete migration."); st.stop(); + MongoRunner.stopMongod(staticMongod); })(); diff --git a/jstests/sharding/migration_move_chunk_after_receive.js b/jstests/sharding/migration_move_chunk_after_receive.js index 08129343ac8..662dc1879e4 100644 --- a/jstests/sharding/migration_move_chunk_after_receive.js +++ b/jstests/sharding/migration_move_chunk_after_receive.js @@ -70,4 +70,5 @@ load('./jstests/libs/chunk_manipulation_util.js'); assert.eq(4, foundDocs.length, 'Incorrect number of documents found ' + tojson(foundDocs)); st.stop(); + MongoRunner.stopMongod(staticMongod); })(); diff --git a/jstests/sharding/migration_server_status.js b/jstests/sharding/migration_server_status.js index f084f094dd2..63f4c828d1e 100644 --- a/jstests/sharding/migration_server_status.js +++ b/jstests/sharding/migration_server_status.js @@ -72,5 +72,6 @@ load('./jstests/libs/chunk_manipulation_util.js'); assert(!shard0ServerStatus.sharding.migrations); st.stop(); + MongoRunner.stopMongod(staticMongod); })(); diff --git a/jstests/sharding/migration_sets_fromMigrate_flag.js b/jstests/sharding/migration_sets_fromMigrate_flag.js index 5a19e5ede95..7b0802286b1 100644 --- a/jstests/sharding/migration_sets_fromMigrate_flag.js +++ b/jstests/sharding/migration_sets_fromMigrate_flag.js @@ -190,4 +190,5 @@ load('./jstests/libs/chunk_manipulation_util.js'); "migration! Test #5 failed."); st.stop(); + MongoRunner.stopMongod(staticMongod); })(); diff --git a/jstests/sharding/migration_with_source_ops.js b/jstests/sharding/migration_with_source_ops.js index b837191c4ee..2fc2c467c0f 100644 --- a/jstests/sharding/migration_with_source_ops.js +++ b/jstests/sharding/migration_with_source_ops.js @@ -139,6 +139,7 @@ load('./jstests/libs/chunk_manipulation_util.js'); assert.eq(1, recipientCollUpdatedNum, "Update failed on recipient shard during migration!"); jsTest.log('DONE!'); + MongoRunner.stopMongod(staticMongod); st.stop(); })(); diff --git a/jstests/sharding/mongos_wait_csrs_initiate.js b/jstests/sharding/mongos_wait_csrs_initiate.js index fb3cde633c4..9f96cb6ec53 100644 --- a/jstests/sharding/mongos_wait_csrs_initiate.js +++ b/jstests/sharding/mongos_wait_csrs_initiate.js @@ -36,3 +36,5 @@ assert.soon( jsTestLog("got mongos"); assert.commandWorked(mongos2.getDB('admin').runCommand('serverStatus')); +configRS.stopSet(); +MongoRunner.stopMongos(mongos); diff --git a/jstests/sharding/move_chunk_wc.js b/jstests/sharding/move_chunk_wc.js index 0cc8c163b6e..3d7e1e9edb9 100644 --- a/jstests/sharding/move_chunk_wc.js +++ b/jstests/sharding/move_chunk_wc.js @@ -101,4 +101,5 @@ load('jstests/libs/write_concern_util.js'); assert.commandFailed(res); assert(!res.writeConcernError, 'moveChunk had writeConcernError: ' + tojson(res)); checkChunkCount(1, 1); + st.stop(); })(); diff --git a/jstests/sharding/movechunk_interrupt_at_primary_stepdown.js b/jstests/sharding/movechunk_interrupt_at_primary_stepdown.js index de7a4f9e4bc..70d0edd6258 100644 --- a/jstests/sharding/movechunk_interrupt_at_primary_stepdown.js +++ b/jstests/sharding/movechunk_interrupt_at_primary_stepdown.js @@ -79,4 +79,5 @@ load('./jstests/libs/chunk_manipulation_util.js'); .itcount()); st.stop(); + MongoRunner.stopMongod(staticMongod); })(); diff --git a/jstests/sharding/movechunk_parallel.js b/jstests/sharding/movechunk_parallel.js index 9de8da268f1..8e54d0ab551 100644 --- a/jstests/sharding/movechunk_parallel.js +++ b/jstests/sharding/movechunk_parallel.js @@ -77,4 +77,5 @@ load('./jstests/libs/chunk_manipulation_util.js'); .itcount()); st.stop(); + MongoRunner.stopMongod(staticMongod); })(); diff --git a/jstests/sharding/mr_noscripting.js b/jstests/sharding/mr_noscripting.js index a2940d51c43..40bfcf2eb62 100644 --- a/jstests/sharding/mr_noscripting.js +++ b/jstests/sharding/mr_noscripting.js @@ -37,3 +37,4 @@ mongos.getDB('config').shards.find().forEach(function(shardDoc) { assert(cmdResult.ok, 'serverStatus on ' + shardDoc.host + ' failed, result: ' + tojson(cmdResult)); }); +st.stop(); diff --git a/jstests/sharding/names.js b/jstests/sharding/names.js index 33a337e5656..48064c813ba 100644 --- a/jstests/sharding/names.js +++ b/jstests/sharding/names.js @@ -46,7 +46,8 @@ rsB.getURL(), config.shards.findOne({_id: rsA.name})["host"], "Wrong host for shard rsA 3"); assert.eq( rsA.getURL(), config.shards.findOne({_id: rsB.name})["host"], "Wrong host for shard rsB 3"); - + rsA.stopSet(); + rsB.stopSet(); st.stop(); })(); diff --git a/jstests/sharding/nonreplicated_uuids_on_shardservers.js b/jstests/sharding/nonreplicated_uuids_on_shardservers.js index f91c5d88cc7..dc579ebabe6 100644 --- a/jstests/sharding/nonreplicated_uuids_on_shardservers.js +++ b/jstests/sharding/nonreplicated_uuids_on_shardservers.js @@ -19,4 +19,5 @@ // Ensure the new node has UUIDs for all its collections. checkCollectionUUIDs(secondaryAdminDB, /*isDowngrade*/ false); + st.stop(); })(); diff --git a/jstests/sharding/query_config.js b/jstests/sharding/query_config.js index 64743e84e11..4b0761790d4 100644 --- a/jstests/sharding/query_config.js +++ b/jstests/sharding/query_config.js @@ -386,4 +386,5 @@ queryConfigChunks(st); queryUserCreated(configDB); queryUserCreated(adminDB); + st.stop(); })(); diff --git a/jstests/sharding/read_after_optime.js b/jstests/sharding/read_after_optime.js index c4e6b16aaa8..919f44f9b52 100644 --- a/jstests/sharding/read_after_optime.js +++ b/jstests/sharding/read_after_optime.js @@ -48,4 +48,5 @@ } return false; }, 'Did not see any log entries containing the following message: ' + msg, 60000, 300); + shardingTest.stop(); })(); diff --git a/jstests/sharding/read_committed_lookup.js b/jstests/sharding/read_committed_lookup.js index f2249ddf756..90808f319db 100644 --- a/jstests/sharding/read_committed_lookup.js +++ b/jstests/sharding/read_committed_lookup.js @@ -60,5 +60,6 @@ load("jstests/libs/read_committed_lib.js"); // For testReadCommittedLookup testReadCommittedLookup(st.s.getDB("test"), shardSecondary, rst); st.stop(); + rst.stopSet(); })(); diff --git a/jstests/sharding/read_pref.js b/jstests/sharding/read_pref.js index 0640c347871..6f0db25f90e 100644 --- a/jstests/sharding/read_pref.js +++ b/jstests/sharding/read_pref.js @@ -28,6 +28,7 @@ TestData.skipCheckingUUIDsConsistentAcrossCluster = true; // The $-prefixed query syntax is only legal for compatibility mode reads, not for the // find/getMore commands. if (useDollarQuerySyntax && st.s.getDB("test").getMongo().useReadCommands()) { + st.stop(); return; } diff --git a/jstests/sharding/refresh_sessions.js b/jstests/sharding/refresh_sessions.js index 1e2bac22c8e..8199ffb4563 100644 --- a/jstests/sharding/refresh_sessions.js +++ b/jstests/sharding/refresh_sessions.js @@ -78,4 +78,6 @@ sessionCount + 3, "refresh on shard did not flush session records to disk"); } + + cluster.stop(); })(); diff --git a/jstests/sharding/sessions_collection_auto_healing.js b/jstests/sharding/sessions_collection_auto_healing.js index 0c7ab95fa42..5dcf6d66590 100644 --- a/jstests/sharding/sessions_collection_auto_healing.js +++ b/jstests/sharding/sessions_collection_auto_healing.js @@ -136,5 +136,6 @@ load('jstests/libs/sessions_collection.js'); } st.stop(); + rs.stopSet(); })(); diff --git a/jstests/sharding/shard7.js b/jstests/sharding/shard7.js index ce0ce708784..0f7f7acc28b 100644 --- a/jstests/sharding/shard7.js +++ b/jstests/sharding/shard7.js @@ -52,3 +52,5 @@ c.save({a: 2, b: 2, loc: [0, 0]}); near = db.runCommand({geoNear: 'foo', near: [0, 0], query: unsatisfiable}); assert.commandWorked(near); assert.eq(0, near.results.length); + +s.stop(); diff --git a/jstests/sharding/sharding_system_namespaces.js b/jstests/sharding/sharding_system_namespaces.js index f721c07634d..851a1d06582 100644 --- a/jstests/sharding/sharding_system_namespaces.js +++ b/jstests/sharding/sharding_system_namespaces.js @@ -60,3 +60,4 @@ if (Array.contains(storageEngines, "wiredTiger")) { } else { print("Skipping test. wiredTiger engine not supported by mongod binary."); } +st.stop(); diff --git a/jstests/sharding/startup_with_all_configs_down.js b/jstests/sharding/startup_with_all_configs_down.js index bd791b71b2f..cef9ec46327 100644 --- a/jstests/sharding/startup_with_all_configs_down.js +++ b/jstests/sharding/startup_with_all_configs_down.js @@ -97,4 +97,5 @@ TestData.skipCheckingUUIDsConsistentAcrossCluster = true; assert.eq(100, newMongosConn.getDB('test').foo.find().itcount()); st.stop(); + MongoRunner.stopMongos(newMongosInfo); }()); diff --git a/jstests/sharding/validate_collection.js b/jstests/sharding/validate_collection.js index 80502ef8cbb..b67a42df6ea 100644 --- a/jstests/sharding/validate_collection.js +++ b/jstests/sharding/validate_collection.js @@ -81,4 +81,6 @@ setFailValidateFailPointOnShard(true, primaryShard); validate(false); setFailValidateFailPointOnShard(false, primaryShard); + + st.stop(); })(); diff --git a/jstests/slow1/replsets_priority1.js b/jstests/slow1/replsets_priority1.js index dfd31173b6b..7ef83965e78 100644 --- a/jstests/slow1/replsets_priority1.js +++ b/jstests/slow1/replsets_priority1.js @@ -202,4 +202,5 @@ rs.awaitReplication(); } + rs.stopSet(); })(); diff --git a/jstests/ssl/disable_x509.js b/jstests/ssl/disable_x509.js index f23ab91534e..a86cc039144 100644 --- a/jstests/ssl/disable_x509.js +++ b/jstests/ssl/disable_x509.js @@ -43,4 +43,7 @@ if (cmdOut.ok) { assert(!external.auth({user: CLIENT_USER, mechanism: 'MONGODB-X509'}), "authentication with disabled auth mechanism succeeded"); + MongoRunner.stopMongod(conn); +} else { + MongoRunner.stopMongod(conn); } diff --git a/jstests/ssl/initial_sync1_x509.js b/jstests/ssl/initial_sync1_x509.js index 564756cc6ca..c49ab37df5a 100644 --- a/jstests/ssl/initial_sync1_x509.js +++ b/jstests/ssl/initial_sync1_x509.js @@ -100,3 +100,4 @@ var conns = replTest.startSet(); assert.throws(function() { replTest.initiate(); }); +replTest.stopSet(); diff --git a/jstests/ssl/libs/ssl_helpers.js b/jstests/ssl/libs/ssl_helpers.js index 6dc20a4923c..ee5d4f05a92 100644 --- a/jstests/ssl/libs/ssl_helpers.js +++ b/jstests/ssl/libs/ssl_helpers.js @@ -1,5 +1,9 @@ load('jstests/multiVersion/libs/multi_rs.js'); +// Do not fail if this test leaves unterminated processes because this file expects replset1.js to +// throw for invalid SSL options. +TestData.failIfUnterminatedProcesses = false; + //=== Shared SSL testing library functions and constants === var KEYFILE = "jstests/libs/key1"; @@ -55,12 +59,8 @@ var replShouldFail = function(name, opt1, opt2) { ssl_options1 = opt1; ssl_options2 = opt2; ssl_name = name; - replTest = null; assert.throws(load, [replSetTestFile], "This setup should have failed"); - // clean up to continue running... - if (replTest) { - replTest.stopSet(); - } + // Note: this leaves running mongod processes. }; /** diff --git a/jstests/ssl/repl_ssl_noca.js b/jstests/ssl/repl_ssl_noca.js index b006136f679..dedae46d62a 100644 --- a/jstests/ssl/repl_ssl_noca.js +++ b/jstests/ssl/repl_ssl_noca.js @@ -48,4 +48,5 @@ var disableSSLURL = `mongodb://${nodeList}/admin?replicaSet=${replTest.name}&ssl=false`; jsTestLog(`Replica set url (doesnt use SSL): ${disableSSLURL}`); assert.neq(checkShellOkay(disableSSLURL), 0, "shell correctly failed to connect without SSL"); + replTest.stopSet(); })(); diff --git a/jstests/ssl/shell_option_parsing.js b/jstests/ssl/shell_option_parsing.js index cc043d57115..8703e710343 100644 --- a/jstests/ssl/shell_option_parsing.js +++ b/jstests/ssl/shell_option_parsing.js @@ -181,4 +181,5 @@ usernameX509, '--authenticationMechanism', 'MONGODB-X509'); + rst.stopSet(); })(); diff --git a/jstests/ssl/ssl_cert_password.js b/jstests/ssl/ssl_cert_password.js index a9590d92777..2595510ff4a 100644 --- a/jstests/ssl/ssl_cert_password.js +++ b/jstests/ssl/ssl_cert_password.js @@ -170,4 +170,6 @@ if (!_isWindows()) { // Stop the server var exitCode = MongoRunner.stopMongod(md); assert(exitCode == 0); +} else { + MongoRunner.stopMongod(md); } diff --git a/jstests/ssl/ssl_cluster_file.js b/jstests/ssl/ssl_cluster_file.js index aa77b875530..a7296a3b731 100644 --- a/jstests/ssl/ssl_cluster_file.js +++ b/jstests/ssl/ssl_cluster_file.js @@ -31,5 +31,5 @@ 0, mongo, "Connection attempt failed when an irrelevant sslClusterFile was provided to the server!"); - + MongoRunner.stopMongod(mongod); }()); diff --git a/jstests/ssl/ssl_crl_revoked.js b/jstests/ssl/ssl_crl_revoked.js index cfe5d03d285..a09eabeb314 100644 --- a/jstests/ssl/ssl_crl_revoked.js +++ b/jstests/ssl/ssl_crl_revoked.js @@ -22,3 +22,4 @@ var mongo = runMongoProgram("mongo", // 1 is the exit code for the shell failing to connect, which is what we want // for a successful test. assert(mongo == 1); +MongoRunner.stopMongod(md); diff --git a/jstests/ssl/ssl_weak.js b/jstests/ssl/ssl_weak.js index c5ea8a27a6e..7827093ea6b 100644 --- a/jstests/ssl/ssl_weak.js +++ b/jstests/ssl/ssl_weak.js @@ -30,7 +30,7 @@ mongo = runMongoProgram("mongo", // 0 is the exit code for success assert(mongo == 0); - +MongoRunner.stopMongod(md); // Test that connecting with no client certificate and no --sslAllowConnectionsWithoutCertificates // fails to connect. var md2 = MongoRunner.runMongod({ @@ -44,3 +44,4 @@ mongo = runMongoProgram( // 1 is the exit code for failure assert(mongo == 1); +MongoRunner.stopMongod(md2); diff --git a/jstests/ssl/ssl_with_system_ca.js b/jstests/ssl/ssl_with_system_ca.js index 194712c98ca..494177f6c3d 100644 --- a/jstests/ssl/ssl_with_system_ca.js +++ b/jstests/ssl/ssl_with_system_ca.js @@ -4,6 +4,10 @@ // for details. ((function() { 'use strict'; + // Do not fail if this test leaves unterminated processes because testWithCerts + // is expected to throw before it calls stopMongod. + TestData.failIfUnterminatedProcesses = false; + const HOST_TYPE = getBuildInfo().buildEnvironment.target_os; if (HOST_TYPE == "windows") { @@ -35,6 +39,7 @@ }; assert.throws(function() { + // Note: this leaves a running mongod process. testWithCerts("server.pem", "client.pem"); }); assert.doesNotThrow(function() { diff --git a/jstests/ssl/upgrade_to_ssl.js b/jstests/ssl/upgrade_to_ssl.js index f1f8409b2a5..d062e8407d5 100644 --- a/jstests/ssl/upgrade_to_ssl.js +++ b/jstests/ssl/upgrade_to_ssl.js @@ -47,3 +47,4 @@ assert.eq(3, rstConn3.getDB("test").a.count(), "Error interacting with replSet") var canConnectSSL = runMongoProgram( "mongo", "--port", rst.ports[0], "--ssl", "--sslAllowInvalidCertificates", "--eval", ";"); assert.eq(0, canConnectSSL, "SSL Connection attempt failed when it should succeed"); +rst.stopSet(); diff --git a/jstests/ssl/upgrade_to_x509_ssl.js b/jstests/ssl/upgrade_to_x509_ssl.js index da8eb099b38..51c5418713c 100644 --- a/jstests/ssl/upgrade_to_x509_ssl.js +++ b/jstests/ssl/upgrade_to_x509_ssl.js @@ -100,3 +100,4 @@ authAllNodes(); var rstConn4 = rst.getPrimary(); rstConn4.getDB("test").a.insert({a: 4, str: "TESTTESTTEST"}); assert.eq(4, rstConn4.getDB("test").a.count(), "Error interacting with replSet"); +rst.stopSet(); diff --git a/jstests/ssl/x509_client.js b/jstests/ssl/x509_client.js index ec9b63e6dba..ec65d163a01 100644 --- a/jstests/ssl/x509_client.js +++ b/jstests/ssl/x509_client.js @@ -105,3 +105,4 @@ var st = new ShardingTest({ }); authAndTest(new Mongo("localhost:" + st.s0.port)); +st.stop(); diff --git a/jstests/sslSpecial/upgrade_to_ssl_nossl.js b/jstests/sslSpecial/upgrade_to_ssl_nossl.js index 11d43040d93..af151d1be01 100644 --- a/jstests/sslSpecial/upgrade_to_ssl_nossl.js +++ b/jstests/sslSpecial/upgrade_to_ssl_nossl.js @@ -32,3 +32,4 @@ assert.eq(3, rstConn3.getDB("test").a.count(), "Error interacting with replSet") var canConnectSSL = runMongoProgram( "mongo", "--port", rst.ports[0], "--ssl", "--sslAllowInvalidCertificates", "--eval", ";"); assert.eq(0, canConnectSSL, "SSL Connection attempt failed when it should succeed"); +rst.stopSet(); diff --git a/jstests/sslSpecial/upgrade_to_x509_ssl_nossl.js b/jstests/sslSpecial/upgrade_to_x509_ssl_nossl.js index 11281c4c6f8..2dd4456e4ef 100644 --- a/jstests/sslSpecial/upgrade_to_x509_ssl_nossl.js +++ b/jstests/sslSpecial/upgrade_to_x509_ssl_nossl.js @@ -131,3 +131,4 @@ var canConnectSSL = runMongoProgram("mongo", "--eval", ";"); assert.eq(0, canConnectSSL, "SSL Connection attempt failed when it should succeed"); +rst.stopSet(); diff --git a/jstests/tool/dumpauth.js b/jstests/tool/dumpauth.js index 795e63f4378..d9d3d1c71ef 100644 --- a/jstests/tool/dumpauth.js +++ b/jstests/tool/dumpauth.js @@ -44,3 +44,4 @@ assert.eq(exitCode, 0, "mongodump should succeed with authentication"); exitCode = MongoRunner.runMongoTool("bsondump", {}, dumpDir + "/" + dbName + "/" + profileName + ".bson"); assert.eq(exitCode, 0, "bsondump should succeed parsing the profile data"); +MongoRunner.stopMongod(m); diff --git a/jstests/tool/dumprestore7.js b/jstests/tool/dumprestore7.js index b4e2d82bb3d..e39c691784b 100644 --- a/jstests/tool/dumprestore7.js +++ b/jstests/tool/dumprestore7.js @@ -79,6 +79,7 @@ assert.eq(count, 20, "mongorestore should only have inserted the latter 20 entries"); } + MongoRunner.stopMongod(restoreMongod); step("stopping replset test"); replTest.stopSet(); })(); diff --git a/jstests/tool/exportimport_bigarray.js b/jstests/tool/exportimport_bigarray.js index 60642b6afb1..cd3219a70cd 100644 --- a/jstests/tool/exportimport_bigarray.js +++ b/jstests/tool/exportimport_bigarray.js @@ -57,3 +57,4 @@ assert(!dst_cursor.hasNext(), 'Source has ' + documentCount + ' documents.'); print('Verified that source and destination collections match'); +tt.stop(); diff --git a/jstests/tool/exportimport_date.js b/jstests/tool/exportimport_date.js index ab51e0a2458..94ca7644d29 100644 --- a/jstests/tool/exportimport_date.js +++ b/jstests/tool/exportimport_date.js @@ -49,3 +49,4 @@ assert(!dst_cursor.hasNext(), 'Source has ' + documentCount + ' documents.'); print('Verified that source and destination collections match'); +tt.stop(); diff --git a/jstests/tool/exportimport_minkey_maxkey.js b/jstests/tool/exportimport_minkey_maxkey.js index c6e1d5b7ea2..88e09252792 100644 --- a/jstests/tool/exportimport_minkey_maxkey.js +++ b/jstests/tool/exportimport_minkey_maxkey.js @@ -37,3 +37,4 @@ assert(!dst_cursor.hasNext(), 'Source has ' + documentCount + ' documents.'); print('Verified that source and destination collections match'); +tt.stop(); diff --git a/jstests/tool/stat1.js b/jstests/tool/stat1.js index 534f21e0367..5fa2b7ba5ea 100644 --- a/jstests/tool/stat1.js +++ b/jstests/tool/stat1.js @@ -25,3 +25,4 @@ exitCode = MongoRunner.runMongoTool("mongostat", { authenticationDatabase: "admin", }); assert.neq(exitCode, 0, "mongostat should exit with -1 with eliot:wrong"); +MongoRunner.stopMongod(m); diff --git a/jstests/tool/tool1.js b/jstests/tool/tool1.js index c968d746742..24133b3aa84 100644 --- a/jstests/tool/tool1.js +++ b/jstests/tool/tool1.js @@ -68,3 +68,4 @@ assert.eq( assert.soon("c.findOne()", "mongo import json A"); assert(c.findOne() && 1 == c.findOne().a, "mongo import json B"); +MongoRunner.stopMongod(m); |