From fa5aff14111de4fe23ae0094c597673cc4a48d3b Mon Sep 17 00:00:00 2001 From: Ali Mir Date: Wed, 16 Sep 2020 19:00:02 +0000 Subject: SERVER-50651 Replace occurrences of isMaster command with hello in misc jstests --- jstests/auth/arbiter.js | 2 +- jstests/auth/auth1.js | 2 +- jstests/auth/getMore.js | 6 +++--- jstests/auth/keyfile_rollover.js | 4 ++-- jstests/auth/pre_auth_commands_with_sessions.js | 2 +- jstests/auth/sasl_mechanism_discovery.js | 10 +++++----- jstests/change_streams/apply_ops_resumability.js | 2 +- jstests/change_streams/report_post_batch_resume_token.js | 2 +- jstests/change_streams/start_at_cluster_time.js | 4 ++-- jstests/concurrency/fsm_workload_helpers/chunks.js | 6 +++--- .../fsm_workloads/auth_privilege_consistency.js | 10 +++++----- .../fsm_workloads/sharded_mergeChunks_partitioned.js | 4 ++-- .../fsm_workloads/sharded_splitChunk_partitioned.js | 4 ++-- jstests/core/automation_setparameter.js | 12 ++++++------ jstests/core/batch_write_command_delete.js | 2 +- jstests/core/batch_write_command_insert.js | 2 +- jstests/core/batch_write_command_update.js | 2 +- jstests/core/clone_as_capped_nonexistant.js | 2 +- jstests/core/collation.js | 8 ++++---- jstests/core/collmod.js | 2 +- jstests/core/commands_namespace_parsing.js | 6 +++--- jstests/core/commands_with_uuid.js | 6 +++--- jstests/core/create_indexes.js | 2 +- jstests/core/dbadmin.js | 8 ++++---- jstests/core/dbstats.js | 2 +- jstests/core/expr.js | 6 +++--- jstests/core/failcommand_failpoint.js | 11 +++++++++-- jstests/core/geo_2d_trailing_fields.js | 2 -- jstests/core/getlog2.js | 2 +- jstests/core/index8.js | 4 ++-- jstests/core/ismaster.js | 14 ++++++++++++++ jstests/core/json_schema/misc_validation.js | 2 +- jstests/core/max_doc_size.js | 2 +- jstests/core/operation_latency_histogram.js | 6 +++--- jstests/core/plan_cache_clear.js | 2 +- jstests/core/regex.js | 6 +++--- jstests/core/set_param1.js | 2 +- jstests/core/splitvector.js | 2 +- .../commands_banning_txnnumber_outside_transactions.js | 2 +- jstests/core/txns/commands_not_allowed_in_txn.js | 2 +- jstests/core/txns/dbstats_not_blocked_by_txn.js | 2 +- jstests/core/txns/list_collections_not_blocked_by_txn.js | 2 +- jstests/core/txns/noop_createIndexes_not_blocked_by_txn.js | 2 +- jstests/core/txns/statement_ids_accepted.js | 2 +- jstests/core/views/invalid_system_views.js | 2 +- jstests/core/views/views_all_commands.js | 6 +++--- jstests/core/views/views_stats.js | 4 ++-- jstests/core/write_result.js | 2 +- jstests/gle/opcounters_legacy.js | 2 +- jstests/ssl/config-canonicalize-normal-ports.js | 2 +- jstests/ssl/repl_ssl_split_horizon.js | 4 +++- jstests/ssl/set_parameter_ssl.js | 2 +- jstests/ssl/ssl_cluster_ca.js | 2 +- jstests/ssl/ssl_uri.js | 6 +++--- jstests/sslSpecial/ssl_ecdsa_cert.js | 2 +- jstests/sslSpecial/x509_cluster_auth_rollover.js | 2 +- 56 files changed, 121 insertions(+), 100 deletions(-) (limited to 'jstests') diff --git a/jstests/auth/arbiter.js b/jstests/auth/arbiter.js index 8ab1cc322f6..24d5ebd58f7 100644 --- a/jstests/auth/arbiter.js +++ b/jstests/auth/arbiter.js @@ -48,7 +48,7 @@ const testCases = [ }, { command: { - isMaster: 1, + hello: 1, "$clusterTime": { clusterTime: Timestamp(1, 1), signature: {hash: BinData(0, "AAAAAAAAAAAAAAAAAAAAAAAAAAA="), keyId: NumberLong(0)} diff --git a/jstests/auth/auth1.js b/jstests/auth/auth1.js index 4498c9acc23..65e12f04425 100644 --- a/jstests/auth/auth1.js +++ b/jstests/auth/auth1.js @@ -66,7 +66,7 @@ function runTest(m) { assert.eq(1000, tRO.count(), "B1"); assert.eq(1000, tRO.find().toArray().length, "B2"); // make sure we have a getMore in play - assert.commandWorked(dbRO.runCommand({ismaster: 1}), "B3"); + assert.commandWorked(dbRO.runCommand({hello: 1}), "B3"); assert.writeError(tRO.save({})); diff --git a/jstests/auth/getMore.js b/jstests/auth/getMore.js index 93570d6556f..00c150d59a0 100644 --- a/jstests/auth/getMore.js +++ b/jstests/auth/getMore.js @@ -8,9 +8,9 @@ TestData.disableImplicitSessions = true; function runTest(conn) { let adminDB = conn.getDB("admin"); - let isMaster = adminDB.runCommand("ismaster"); - assert.commandWorked(isMaster); - const isMongos = (isMaster.msg === "isdbgrid"); + let hello = adminDB.runCommand("hello"); + assert.commandWorked(hello); + const isMongos = (hello.msg === "isdbgrid"); // Create the admin user. assert.commandWorked(adminDB.runCommand({createUser: "admin", pwd: "admin", roles: ["root"]})); diff --git a/jstests/auth/keyfile_rollover.js b/jstests/auth/keyfile_rollover.js index 8e16c15b623..74a9bca8695 100644 --- a/jstests/auth/keyfile_rollover.js +++ b/jstests/auth/keyfile_rollover.js @@ -62,12 +62,12 @@ const rolloverKey = function(keyFileForServers, keyFileForAuth) { restart(secondary); }); - // Then we restart the primary and wait for it to come back up with an ismaster call. + // Then we restart the primary and wait for it to come back up with an hello call. const primary = rst.getPrimary(); restart(primary); assert.soonNoExcept(() => { authutil.asCluster(rst.nodes, keyFileForAuth, () => { - assert.commandWorked(primary.getDB("admin").runCommand({isMaster: 1})); + assert.commandWorked(primary.getDB("admin").runCommand({hello: 1})); }); return true; }); diff --git a/jstests/auth/pre_auth_commands_with_sessions.js b/jstests/auth/pre_auth_commands_with_sessions.js index 19bee66efb6..49e6cc6d711 100644 --- a/jstests/auth/pre_auth_commands_with_sessions.js +++ b/jstests/auth/pre_auth_commands_with_sessions.js @@ -43,7 +43,7 @@ var testCommand = function(cmd) { admin.logout(); }; -var commands = ["ping", "ismaster"]; +var commands = ["ping", "hello"]; for (var i = 0; i < commands.length; i++) { testCommand(commands[i]); } diff --git a/jstests/auth/sasl_mechanism_discovery.js b/jstests/auth/sasl_mechanism_discovery.js index e64c8e3c545..9eda7dd5802 100644 --- a/jstests/auth/sasl_mechanism_discovery.js +++ b/jstests/auth/sasl_mechanism_discovery.js @@ -1,11 +1,11 @@ -// Tests that a client may discover a user's supported SASL mechanisms via isMaster. +// Tests that a client may discover a user's supported SASL mechanisms via hello. // @tags: [requires_sharding] (function() { "use strict"; function runTest(conn) { function checkMechs(userid, mechs) { - const res = assert.commandWorked(db.runCommand({isMaster: 1, saslSupportedMechs: userid})); + const res = assert.commandWorked(db.runCommand({hello: 1, saslSupportedMechs: userid})); assert.eq(mechs.sort(), res.saslSupportedMechs.sort(), tojson(res)); } @@ -16,12 +16,12 @@ function runTest(conn) { {createUser: "userAdmin", pwd: "userAdmin", roles: ["userAdminAnyDatabase"]})); db.auth("userAdmin", "userAdmin"); - // Check that unknown users do not interrupt isMaster - let res = assert.commandWorked(db.runCommand({isMaster: 1, saslSupportedMechs: "test.bogus"})); + // Check that unknown users do not interrupt hello + let res = assert.commandWorked(db.runCommand({hello: 1, saslSupportedMechs: "test.bogus"})); assert.eq(undefined, res.saslSupportedMechs); // Check that invalid usernames produce the correct error code - assert.commandFailedWithCode(db.runCommand({isMaster: 1, saslSupportedMechs: "bogus"}), + assert.commandFailedWithCode(db.runCommand({hello: 1, saslSupportedMechs: "bogus"}), ErrorCodes.BadValue); assert.commandWorked(db.runCommand({createUser: "user", pwd: "pwd", roles: []})); diff --git a/jstests/change_streams/apply_ops_resumability.js b/jstests/change_streams/apply_ops_resumability.js index 4f969961017..b4f11f8bd76 100644 --- a/jstests/change_streams/apply_ops_resumability.js +++ b/jstests/change_streams/apply_ops_resumability.js @@ -23,7 +23,7 @@ let changeStream = cst.startWatchingChanges( {pipeline: [{$changeStream: {}}, {$project: {"lsid.uid": 0}}], collection: coll}); // Record the clusterTime at the outset of the test, before any writes are performed. -const testStartTime = db.isMaster().$clusterTime.clusterTime; +const testStartTime = db.hello().$clusterTime.clusterTime; // Do an insert outside of a transaction. assert.commandWorked(coll.insert({_id: 0, a: 123})); diff --git a/jstests/change_streams/report_post_batch_resume_token.js b/jstests/change_streams/report_post_batch_resume_token.js index b8f975d2585..37f5f6cea3f 100644 --- a/jstests/change_streams/report_post_batch_resume_token.js +++ b/jstests/change_streams/report_post_batch_resume_token.js @@ -123,7 +123,7 @@ assert.soon(() => { }); // Insert two documents into the collection which are of the maximum BSON object size. -const bsonUserSizeLimit = assert.commandWorked(adminDB.isMaster()).maxBsonObjectSize; +const bsonUserSizeLimit = assert.commandWorked(adminDB.hello()).maxBsonObjectSize; assert.gt(bsonUserSizeLimit, 0); for (let i = 0; i < 2; ++i) { const docToInsert = {_id: docId++, padding: ""}; diff --git a/jstests/change_streams/start_at_cluster_time.js b/jstests/change_streams/start_at_cluster_time.js index 9b289f26bc9..77d85514016 100644 --- a/jstests/change_streams/start_at_cluster_time.js +++ b/jstests/change_streams/start_at_cluster_time.js @@ -5,7 +5,7 @@ load("jstests/libs/collection_drop_recreate.js"); // For assert[Drop|Create]Col const coll = assertDropAndRecreateCollection(db, jsTestName()); -const testStartTime = db.runCommand({isMaster: 1}).$clusterTime.clusterTime; +const testStartTime = db.runCommand({hello: 1}).$clusterTime.clusterTime; // Write a document to each chunk, and wait for replication. assert.commandWorked(coll.insert({_id: -1}, {writeConcern: {w: "majority"}})); @@ -45,7 +45,7 @@ assert.commandFailedWithCode(db.runCommand({ 40674); // Test that resuming from a time in the future will wait for that time to come. -let resumeTimeFarFuture = db.runCommand({isMaster: 1}).$clusterTime.clusterTime; +let resumeTimeFarFuture = db.runCommand({hello: 1}).$clusterTime.clusterTime; resumeTimeFarFuture = new Timestamp(resumeTimeFarFuture.getTime() + 60 * 60 * 6, 1); // 6 hours in the future diff --git a/jstests/concurrency/fsm_workload_helpers/chunks.js b/jstests/concurrency/fsm_workload_helpers/chunks.js index 749e188d792..fbf88c226a7 100644 --- a/jstests/concurrency/fsm_workload_helpers/chunks.js +++ b/jstests/concurrency/fsm_workload_helpers/chunks.js @@ -109,7 +109,7 @@ var ChunkHelper = (function() { // Take a set of connections to a shard (replica set or standalone mongod), // or a set of connections to the config servers, and return a connection - // to any node in the set for which ismaster is true. + // to any node in the set for which isWritablePrimary is true. function getPrimary(connArr) { const kDefaultTimeoutMS = 10 * 60 * 1000; // 10 minutes. assertAlways(Array.isArray(connArr), 'Expected an array but got ' + tojson(connArr)); @@ -118,10 +118,10 @@ var ChunkHelper = (function() { assert.soon(() => { for (let conn of connArr) { assert(isMongod(conn.getDB('admin')), tojson(conn) + ' is not to a mongod'); - let res = conn.adminCommand({isMaster: 1}); + let res = conn.adminCommand({hello: 1}); assertAlways.commandWorked(res); - if (res.ismaster) { + if (res.isWritablePrimary) { primary = conn; return primary; } diff --git a/jstests/concurrency/fsm_workloads/auth_privilege_consistency.js b/jstests/concurrency/fsm_workloads/auth_privilege_consistency.js index 84de30a332e..3e1d050d803 100644 --- a/jstests/concurrency/fsm_workloads/auth_privilege_consistency.js +++ b/jstests/concurrency/fsm_workloads/auth_privilege_consistency.js @@ -59,12 +59,12 @@ var $config = (function() { // Setup a connection to every member host if this is a replica set // so that we can confirm secondary state during observe(). - const isMaster = assert.commandWorked(db.runCommand({isMaster: 1})); - jsTest.log('isMaster: ' + tojson(isMaster)); - if (isMaster.hosts) { - const allHosts = isMaster.hosts.concat(isMaster.passives); + const hello = assert.commandWorked(db.runCommand({hello: 1})); + jsTest.log('hello: ' + tojson(hello)); + if (hello.hosts) { + const allHosts = hello.hosts.concat(hello.passives); allHosts.forEach(function(node) { - if (node === isMaster.me) { + if (node === hello.me) { // Reuse existing connection for db's connection. const conn = db.getMongo(); RSnodes.push(conn); diff --git a/jstests/concurrency/fsm_workloads/sharded_mergeChunks_partitioned.js b/jstests/concurrency/fsm_workloads/sharded_mergeChunks_partitioned.js index 9be9e1bdaef..e5786a27270 100644 --- a/jstests/concurrency/fsm_workloads/sharded_mergeChunks_partitioned.js +++ b/jstests/concurrency/fsm_workloads/sharded_mergeChunks_partitioned.js @@ -158,9 +158,9 @@ var $config = extendWorkload($config, function($config, $super) { // Verify that all config servers have the correct after-state. // (see comments below for specifics). for (var conn of connCache.config) { - var res = conn.adminCommand({isMaster: 1}); + var res = conn.adminCommand({hello: 1}); assertAlways.commandWorked(res); - if (res.ismaster) { + if (res.isWritablePrimary) { // If the mergeChunks operation succeeded, verify that there is now one chunk // between the original chunks' lower and upper bounds. If the operation failed, // verify that there are still two chunks between the original chunks' lower and diff --git a/jstests/concurrency/fsm_workloads/sharded_splitChunk_partitioned.js b/jstests/concurrency/fsm_workloads/sharded_splitChunk_partitioned.js index 92d8a9357db..8e1c0f6a4c9 100644 --- a/jstests/concurrency/fsm_workloads/sharded_splitChunk_partitioned.js +++ b/jstests/concurrency/fsm_workloads/sharded_splitChunk_partitioned.js @@ -59,9 +59,9 @@ var $config = extendWorkload($config, function($config, $super) { // Verify that all config servers have the correct after-state. // (see comments below for specifics). for (var conn of connCache.config) { - var res = conn.adminCommand({isMaster: 1}); + var res = conn.adminCommand({hello: 1}); assertAlways.commandWorked(res); - if (res.ismaster) { + if (res.isWritablePrimary) { // If the splitChunk operation succeeded, verify that there are now // two chunks between the old chunk's lower and upper bounds. // If the operation failed, verify that there is still only one chunk diff --git a/jstests/core/automation_setparameter.js b/jstests/core/automation_setparameter.js index 6482fdebbfb..09ab2935695 100644 --- a/jstests/core/automation_setparameter.js +++ b/jstests/core/automation_setparameter.js @@ -4,13 +4,13 @@ // ] // Tests that using setParameter to update the parameter 'automationServiceDescriptor' causes a -// field with that name to be echoed back in isMaster. See SERVER-18399 for more details. +// field with that name to be echoed back in hello. See SERVER-18399 for more details. (function() { -// Run isMaster, and if it contains an automation service descriptor, save it, so we can restore +// Run hello, and if it contains an automation service descriptor, save it, so we can restore // it later. If it wasn't set, original will just be undefined. -var res = assert.commandWorked(db.runCommand({isMaster: 1})); +var res = assert.commandWorked(db.runCommand({hello: 1})); var original = res.automationServiceDescriptor; // Try to set the descriptor to an invalid value: only strings are supported. @@ -32,14 +32,14 @@ res = assert.commandWorked( if (original) assert.eq(original, res.was); -// Verify that the 'some_service' string is now echoed back to us in isMaster -res = assert.commandWorked(db.runCommand({isMaster: 1})); +// Verify that the 'some_service' string is now echoed back to us in hello +res = assert.commandWorked(db.runCommand({hello: 1})); assert.eq(res.automationServiceDescriptor, "some_service"); // Verify that setting the descriptor to the empty string is ok, and prevents it from being // echoed back assert.commandWorked(db.adminCommand({setParameter: 1, automationServiceDescriptor: ""})); -res = assert.commandWorked(db.runCommand({isMaster: 1})); +res = assert.commandWorked(db.runCommand({hello: 1})); assert(!res.hasOwnProperty('automationServiceDescriptor')); // Verify that the shell has the correct prompt. diff --git a/jstests/core/batch_write_command_delete.js b/jstests/core/batch_write_command_delete.js index 19410fba69f..4eb9499013b 100644 --- a/jstests/core/batch_write_command_delete.js +++ b/jstests/core/batch_write_command_delete.js @@ -22,7 +22,7 @@ var request; var result; var batch; -var maxWriteBatchSize = db.isMaster().maxWriteBatchSize; +var maxWriteBatchSize = db.hello().maxWriteBatchSize; function resultOK(result) { return result.ok && !('code' in result) && !('errmsg' in result) && !('errInfo' in result) && diff --git a/jstests/core/batch_write_command_insert.js b/jstests/core/batch_write_command_insert.js index e63632e3c5a..cf1b0013ef7 100644 --- a/jstests/core/batch_write_command_insert.js +++ b/jstests/core/batch_write_command_insert.js @@ -25,7 +25,7 @@ var request; var result; var batch; -var maxWriteBatchSize = db.isMaster().maxWriteBatchSize; +var maxWriteBatchSize = db.hello().maxWriteBatchSize; function resultOK(result) { return result.ok && !('code' in result) && !('errmsg' in result) && !('errInfo' in result) && diff --git a/jstests/core/batch_write_command_update.js b/jstests/core/batch_write_command_update.js index d82246e0e4e..edb90be8523 100644 --- a/jstests/core/batch_write_command_update.js +++ b/jstests/core/batch_write_command_update.js @@ -21,7 +21,7 @@ var request; var result; var batch; -var maxWriteBatchSize = db.isMaster().maxWriteBatchSize; +var maxWriteBatchSize = db.hello().maxWriteBatchSize; function resultOK(result) { return result.ok && !('code' in result) && !('errmsg' in result) && !('errInfo' in result) && diff --git a/jstests/core/clone_as_capped_nonexistant.js b/jstests/core/clone_as_capped_nonexistant.js index a4f8cf9787d..18329763a23 100644 --- a/jstests/core/clone_as_capped_nonexistant.js +++ b/jstests/core/clone_as_capped_nonexistant.js @@ -19,7 +19,7 @@ testDb.dropDatabase(); // Database does not exist here var res = testDb.runCommand({cloneCollectionAsCapped: 'foo', toCollection: 'bar', size: 1024}); assert.eq(res.ok, 0, "cloning a nonexistent collection to capped should not have worked"); -var isSharded = (db.isMaster().msg == "isdbgrid"); +var isSharded = (db.hello().msg == "isdbgrid"); assert.eq(res.errmsg, isSharded ? "no such cmd: cloneCollectionAsCapped" : "database " + dbname + " not found", diff --git a/jstests/core/collation.js b/jstests/core/collation.js index 272fcaedefd..5cfedcc8e1f 100644 --- a/jstests/core/collation.js +++ b/jstests/core/collation.js @@ -27,10 +27,10 @@ var explainRes; var writeRes; var planStage; -var isMaster = db.runCommand("ismaster"); -assert.commandWorked(isMaster); -var isMongos = (isMaster.msg === "isdbgrid"); -var isStandalone = !isMongos && !isMaster.hasOwnProperty('setName'); +var hello = db.runCommand("hello"); +assert.commandWorked(hello); +var isMongos = (hello.msg === "isdbgrid"); +var isStandalone = !isMongos && !hello.hasOwnProperty('setName'); var assertIndexHasCollation = function(keyPattern, collation) { var indexSpecs = coll.getIndexes(); diff --git a/jstests/core/collmod.js b/jstests/core/collmod.js index 6a0081edff6..c70a806c2d7 100644 --- a/jstests/core/collmod.js +++ b/jstests/core/collmod.js @@ -20,7 +20,7 @@ var coll = "collModTest"; var t = db.getCollection(coll); t.drop(); -var isMongos = ("isdbgrid" == db.runCommand("ismaster").msg); +var isMongos = ("isdbgrid" == db.runCommand("hello").msg); db.createCollection(coll); diff --git a/jstests/core/commands_namespace_parsing.js b/jstests/core/commands_namespace_parsing.js index 1eda20c57f2..326100542d3 100644 --- a/jstests/core/commands_namespace_parsing.js +++ b/jstests/core/commands_namespace_parsing.js @@ -52,9 +52,9 @@ function assertFailsWithInvalidNamespacesForField( } } -const isMaster = db.runCommand("ismaster"); -assert.commandWorked(isMaster); -const isMongos = (isMaster.msg === "isdbgrid"); +const hello = db.runCommand("hello"); +assert.commandWorked(hello); +const isMongos = (hello.msg === "isdbgrid"); db.commands_namespace_parsing.drop(); assert.commandWorked(db.commands_namespace_parsing.insert({a: 1})); diff --git a/jstests/core/commands_with_uuid.js b/jstests/core/commands_with_uuid.js index ef960448c6b..04d3da65ee3 100644 --- a/jstests/core/commands_with_uuid.js +++ b/jstests/core/commands_with_uuid.js @@ -27,9 +27,9 @@ if (uuid == null) { } // No support for UUIDs on mongos. -const isMaster = db.runCommand("ismaster"); -assert.commandWorked(isMaster); -const isMongos = (isMaster.msg === "isdbgrid"); +const hello = db.runCommand("hello"); +assert.commandWorked(hello); +const isMongos = (hello.msg === "isdbgrid"); if (isMongos) { return; } diff --git a/jstests/core/create_indexes.js b/jstests/core/create_indexes.js index 5e3580a1f6a..1ecab14f65b 100644 --- a/jstests/core/create_indexes.js +++ b/jstests/core/create_indexes.js @@ -6,7 +6,7 @@ (function() { 'use strict'; -var isMongos = ("isdbgrid" == db.runCommand("ismaster").msg); +var isMongos = ("isdbgrid" == db.runCommand("hello").msg); var extractResult = function(obj) { if (!isMongos) diff --git a/jstests/core/dbadmin.js b/jstests/core/dbadmin.js index d624aaed62c..7bd946f1eef 100644 --- a/jstests/core/dbadmin.js +++ b/jstests/core/dbadmin.js @@ -15,15 +15,15 @@ assert(res.databases && res.databases.length > 0 && res.totalSize === undefined, "listDatabases nameOnly: " + tojson(res)); var now = new Date(); -var x = db._adminCommand("ismaster"); -assert(x.ismaster, "ismaster failed: " + tojson(x)); -assert(x.localTime, "ismaster didn't include time: " + tojson(x)); +var x = db._adminCommand("hello"); +assert(x.isWritablePrimary, "hello failed: " + tojson(x)); +assert(x.localTime, "hello didn't include time: " + tojson(x)); var localTimeSkew = x.localTime - now; if (localTimeSkew >= 50) { print("Warning: localTimeSkew " + localTimeSkew + " > 50ms."); } -assert.lt(localTimeSkew, 60 * 60 * 1000 /* one minute */, "isMaster.localTime"); +assert.lt(localTimeSkew, 60 * 60 * 1000 /* one minute */, "hello.localTime"); var before = db.runCommand("serverStatus"); print(before.uptimeEstimate); diff --git a/jstests/core/dbstats.js b/jstests/core/dbstats.js index 7de7003b770..dff5e370702 100644 --- a/jstests/core/dbstats.js +++ b/jstests/core/dbstats.js @@ -9,7 +9,7 @@ "use strict"; function serverIsMongos() { - const res = db.runCommand("ismaster"); + const res = db.runCommand("hello"); assert.commandWorked(res); return res.msg === "isdbgrid"; } diff --git a/jstests/core/expr.js b/jstests/core/expr.js index 05cd676cdf2..1a23ac00d8b 100644 --- a/jstests/core/expr.js +++ b/jstests/core/expr.js @@ -14,9 +14,9 @@ const coll = db.expr; -const isMaster = db.runCommand("ismaster"); -assert.commandWorked(isMaster); -const isMongos = (isMaster.msg === "isdbgrid"); +const hello = db.runCommand("hello"); +assert.commandWorked(hello); +const isMongos = (hello.msg === "isdbgrid"); // // $expr in aggregate. diff --git a/jstests/core/failcommand_failpoint.js b/jstests/core/failcommand_failpoint.js index 9f246dc177e..8098a526ba5 100644 --- a/jstests/core/failcommand_failpoint.js +++ b/jstests/core/failcommand_failpoint.js @@ -69,7 +69,7 @@ assert.commandWorked(adminDB.runCommand({ mode: "alwaysOn", data: { errorCode: ErrorCodes.NotWritablePrimary, - failCommands: ["isMaster"], + failCommands: ["hello"], threadName: threadName, } })); @@ -155,6 +155,7 @@ assert.commandWorked(adminDB.runCommand({ } })); assert.commandFailedWithCode(testDB.runCommand({ping: 1}), ErrorCodes.BadValue); +assert.commandWorked(testDB.runCommand({hello: 1})); assert.commandWorked(testDB.runCommand({isMaster: 1})); assert.commandWorked(testDB.runCommand({buildinfo: 1})); assert.commandWorked(testDB.runCommand({find: "collection"})); @@ -166,11 +167,12 @@ assert.commandWorked(adminDB.runCommand({ mode: "alwaysOn", data: { errorCode: ErrorCodes.BadValue, - failCommands: ["ping", "isMaster"], + failCommands: ["ping", "hello", "isMaster"], threadName: threadName, } })); assert.commandFailedWithCode(testDB.runCommand({ping: 1}), ErrorCodes.BadValue); +assert.commandFailedWithCode(testDB.runCommand({hello: 1}), ErrorCodes.BadValue); assert.commandFailedWithCode(testDB.runCommand({isMaster: 1}), ErrorCodes.BadValue); assert.commandWorked(adminDB.runCommand({configureFailPoint: "failCommand", mode: "off"})); @@ -214,6 +216,7 @@ assert.commandWorked(adminDB.runCommand({ threadName: threadName, } })); +assert.commandWorked(testDB.runCommand({hello: 1})); assert.commandWorked(testDB.runCommand({isMaster: 1})); assert.commandWorked(testDB.runCommand({buildinfo: 1})); assert.commandWorked(testDB.runCommand({ping: 1})); @@ -231,6 +234,7 @@ assert.commandWorked(adminDB.runCommand({ threadName: threadName, } })); +assert.commandWorked(testDB.runCommand({hello: 1})); assert.commandWorked(testDB.runCommand({isMaster: 1})); assert.commandWorked(testDB.runCommand({buildinfo: 1})); assert.commandWorked(testDB.runCommand({find: "c"})); @@ -263,6 +267,7 @@ assert.commandWorked(adminDB.runCommand({ threadName: threadName, } })); +assert.commandWorked(testDB.runCommand({hello: 1})); assert.commandWorked(testDB.runCommand({isMaster: 1})); assert.commandWorked(testDB.runCommand({buildinfo: 1})); assert.commandWorked(testDB.runCommand({find: "c"})); @@ -298,6 +303,7 @@ assert.commandWorked(adminDB.runCommand({ threadName: threadName, } })); +assert.commandWorked(testDB.runCommand({hello: 1})); assert.commandWorked(testDB.runCommand({isMaster: 1})); assert.commandWorked(testDB.runCommand({buildinfo: 1})); assert.commandWorked(testDB.runCommand({ping: 1})); @@ -317,6 +323,7 @@ assert.commandWorked(adminDB.runCommand({ threadName: threadName, } })); +assert.commandWorked(testDB.runCommand({hello: 1})); assert.commandWorked(testDB.runCommand({isMaster: 1})); assert.commandWorked(testDB.runCommand({buildinfo: 1})); assert.commandWorked(testDB.runCommand({find: "c"})); diff --git a/jstests/core/geo_2d_trailing_fields.js b/jstests/core/geo_2d_trailing_fields.js index f31b671f5c3..238c2caefaa 100644 --- a/jstests/core/geo_2d_trailing_fields.js +++ b/jstests/core/geo_2d_trailing_fields.js @@ -7,8 +7,6 @@ const coll = db.geo_2d_trailing_fields; -const isMaster = assert.commandWorked(db.adminCommand({isMaster: 1})); - coll.drop(); assert.commandWorked(coll.createIndex({a: "2d", b: 1})); assert.commandWorked(coll.insert({a: [0, 0]})); diff --git a/jstests/core/getlog2.js b/jstests/core/getlog2.js index 497ef2ee7e8..c7bdd08297c 100644 --- a/jstests/core/getlog2.js +++ b/jstests/core/getlog2.js @@ -42,7 +42,7 @@ function stringContains(haystack, needle) { } // test doesn't work when talking to mongos -if (db.isMaster().msg === "isdbgrid") { +if (db.hello().msg === "isdbgrid") { return; } diff --git a/jstests/core/index8.js b/jstests/core/index8.js index fe43dc30a77..98dbb386d0f 100644 --- a/jstests/core/index8.js +++ b/jstests/core/index8.js @@ -27,8 +27,8 @@ checkIndexes = function(num) { checkIndexes(1); // The reIndex command is only supported in standalone mode. -const isMaster = db.runCommand({isMaster: 1}); -const isStandalone = isMaster.msg !== "isdbgrid" && !isMaster.hasOwnProperty('setName'); +const hello = db.runCommand({hello: 1}); +const isStandalone = hello.msg !== "isdbgrid" && !hello.hasOwnProperty('setName'); if (isStandalone) { assert.commandWorked(t.reIndex()); checkIndexes(2); diff --git a/jstests/core/ismaster.js b/jstests/core/ismaster.js index e9d5e344303..aee8086225b 100644 --- a/jstests/core/ismaster.js +++ b/jstests/core/ismaster.js @@ -65,3 +65,17 @@ function checkResponseFields(commandString) { checkResponseFields("hello"); checkResponseFields("ismaster"); checkResponseFields("isMaster"); + +// We also test the db.hello() and db.isMaster() helpers to ensure that they return +// the same response objects as from running the commands directly. +let cmdResponse1 = db.runCommand("hello"); +let cmdResponse2 = db.hello(); +delete cmdResponse1.localTime; +delete cmdResponse2.localTime; +assert.eq(cmdResponse1, cmdResponse2); + +cmdResponse1 = db.runCommand("isMaster"); +cmdResponse2 = db.isMaster(); +delete cmdResponse1.localTime; +delete cmdResponse2.localTime; +assert.eq(cmdResponse1, cmdResponse2); diff --git a/jstests/core/json_schema/misc_validation.js b/jstests/core/json_schema/misc_validation.js index 2949a55ed92..50bb4fc998b 100644 --- a/jstests/core/json_schema/misc_validation.js +++ b/jstests/core/json_schema/misc_validation.js @@ -37,7 +37,7 @@ assert.commandWorked(testDB.createCollection(testName)); const coll = testDB.getCollection(testName); coll.drop(); -const isMongos = (testDB.runCommand("ismaster").msg === "isdbgrid"); +const isMongos = (testDB.runCommand("hello").msg === "isdbgrid"); // Test that $jsonSchema is rejected in an $elemMatch projection. assert.throws(function() { diff --git a/jstests/core/max_doc_size.js b/jstests/core/max_doc_size.js index 859896c17f6..d47c8eebc5f 100644 --- a/jstests/core/max_doc_size.js +++ b/jstests/core/max_doc_size.js @@ -9,7 +9,7 @@ (function() { 'use strict'; -const maxBsonObjectSize = db.isMaster().maxBsonObjectSize; +const maxBsonObjectSize = db.hello().maxBsonObjectSize; const docOverhead = Object.bsonsize({_id: new ObjectId(), x: ''}); const maxStrSize = maxBsonObjectSize - docOverhead; const maxStr = 'a'.repeat(maxStrSize); diff --git a/jstests/core/operation_latency_histogram.js b/jstests/core/operation_latency_histogram.js index 2bda026025c..6a22ae6faca 100644 --- a/jstests/core/operation_latency_histogram.js +++ b/jstests/core/operation_latency_histogram.js @@ -133,9 +133,9 @@ testColl.getIndexes(); lastHistogram = assertHistogramDiffEq(testColl, lastHistogram, 0, 0, 1); // Reindex (Only standalone mode supports the reIndex command.) -const isMaster = db.runCommand({isMaster: 1}); -const isMongos = (isMaster.msg === "isdbgrid"); -const isStandalone = !isMongos && !isMaster.hasOwnProperty('setName'); +const hello = db.runCommand({hello: 1}); +const isMongos = (hello.msg === "isdbgrid"); +const isStandalone = !isMongos && !hello.hasOwnProperty('setName'); if (isStandalone) { assert.commandWorked(testColl.reIndex()); lastHistogram = assertHistogramDiffEq(testColl, lastHistogram, 0, 0, 1); diff --git a/jstests/core/plan_cache_clear.js b/jstests/core/plan_cache_clear.js index 3bbc9824c4a..5075f3eff16 100644 --- a/jstests/core/plan_cache_clear.js +++ b/jstests/core/plan_cache_clear.js @@ -112,7 +112,7 @@ assert.commandWorked(nonExistentColl.runCommand('planCacheClear')); // Confirm that cache is empty. // (Only standalone mode supports the reIndex command.) const isMongos = db.adminCommand({isdbgrid: 1}).isdbgrid; -const isStandalone = !isMongos && !db.runCommand({isMaster: 1}).hasOwnProperty('setName'); +const isStandalone = !isMongos && !db.runCommand({hello: 1}).hasOwnProperty('setName'); if (isStandalone) { assert.eq(1, coll.find({a: 1, b: 1}).itcount()); assert.eq(1, numPlanCacheEntries(), dumpPlanCacheState()); diff --git a/jstests/core/regex.js b/jstests/core/regex.js index 26a7ae33733..ac28988fa17 100644 --- a/jstests/core/regex.js +++ b/jstests/core/regex.js @@ -8,9 +8,9 @@ const t = db.jstests_regex; -const isMaster = db.runCommand("ismaster"); -assert.commandWorked(isMaster); -const isMongos = (isMaster.msg === "isdbgrid"); +const hello = db.runCommand("hello"); +assert.commandWorked(hello); +const isMongos = (hello.msg === "isdbgrid"); t.drop(); assert.commandWorked(t.save({a: "bcd"})); diff --git a/jstests/core/set_param1.js b/jstests/core/set_param1.js index 6484f2241e2..e1d2c496343 100644 --- a/jstests/core/set_param1.js +++ b/jstests/core/set_param1.js @@ -122,7 +122,7 @@ assert.eq(5, result.accessControl.verbosity); assert.commandWorked( db.adminCommand({"setParameter": 1, logComponentVerbosity: old.logComponentVerbosity})); -var isMongos = (db.isMaster().msg === 'isdbgrid'); +var isMongos = (db.hello().msg === 'isdbgrid'); if (!isMongos) { // // oplogFetcherSteadyStateMaxFetcherRestarts diff --git a/jstests/core/splitvector.js b/jstests/core/splitvector.js index 62a89f3027f..da117c7d3ef 100644 --- a/jstests/core/splitvector.js +++ b/jstests/core/splitvector.js @@ -267,7 +267,7 @@ var case9 = function() { assert.eq(1, res.splitKeys.length, "9b"); assert.eq(2, res.splitKeys[0].x, "9c"); - if (db.runCommand("isMaster").msg != "isdbgrid") { + if (db.runCommand("hello").msg != "isdbgrid") { res = db.adminCommand( {splitVector: "test.jstests_splitvector", keyPattern: {x: 1}, force: true}); diff --git a/jstests/core/txns/commands_banning_txnnumber_outside_transactions.js b/jstests/core/txns/commands_banning_txnnumber_outside_transactions.js index 8946fc84392..d1385dc1a19 100644 --- a/jstests/core/txns/commands_banning_txnnumber_outside_transactions.js +++ b/jstests/core/txns/commands_banning_txnnumber_outside_transactions.js @@ -5,7 +5,7 @@ (function() { "use strict"; -const isMongos = assert.commandWorked(db.runCommand("ismaster")).msg === "isdbgrid"; +const isMongos = assert.commandWorked(db.runCommand("hello")).msg === "isdbgrid"; const session = db.getMongo().startSession(); const sessionDb = session.getDatabase("admin"); diff --git a/jstests/core/txns/commands_not_allowed_in_txn.js b/jstests/core/txns/commands_not_allowed_in_txn.js index 8d161c8b21b..912f01a0a2a 100644 --- a/jstests/core/txns/commands_not_allowed_in_txn.js +++ b/jstests/core/txns/commands_not_allowed_in_txn.js @@ -24,7 +24,7 @@ const sessionOptions = { const session = db.getMongo().startSession(sessionOptions); const sessionDb = session.getDatabase(dbName); -const isMongos = assert.commandWorked(db.runCommand("ismaster")).msg === "isdbgrid"; +const isMongos = assert.commandWorked(db.runCommand("hello")).msg === "isdbgrid"; assert.commandWorked(testDB.createCollection(testColl.getName(), {writeConcern: {w: "majority"}})); assert.commandWorked(testDB.runCommand({ diff --git a/jstests/core/txns/dbstats_not_blocked_by_txn.js b/jstests/core/txns/dbstats_not_blocked_by_txn.js index 6adf567b191..b1c48ba51d1 100644 --- a/jstests/core/txns/dbstats_not_blocked_by_txn.js +++ b/jstests/core/txns/dbstats_not_blocked_by_txn.js @@ -14,7 +14,7 @@ mydb.createCollection("foo", {writeConcern: {w: "majority"}}); var session = db.getMongo().startSession(); var sessionDb = session.getDatabase(dbName); -const isMongos = assert.commandWorked(db.runCommand("ismaster")).msg === "isdbgrid"; +const isMongos = assert.commandWorked(db.runCommand("hello")).msg === "isdbgrid"; if (isMongos) { // Before starting the transaction below, access the collection so it can be implicitly // sharded and force all shards to refresh their database versions because the refresh diff --git a/jstests/core/txns/list_collections_not_blocked_by_txn.js b/jstests/core/txns/list_collections_not_blocked_by_txn.js index fb9cf6340e4..b56699a28ba 100644 --- a/jstests/core/txns/list_collections_not_blocked_by_txn.js +++ b/jstests/core/txns/list_collections_not_blocked_by_txn.js @@ -17,7 +17,7 @@ mydb.foo.drop({writeConcern: {w: "majority"}}); assert.commandWorked(mydb.createCollection("foo", {writeConcern: {w: "majority"}})); -const isMongos = assert.commandWorked(db.runCommand("ismaster")).msg === "isdbgrid"; +const isMongos = assert.commandWorked(db.runCommand("hello")).msg === "isdbgrid"; if (isMongos) { // Before starting the transaction below, access the collection so it can be implicitly // sharded and force all shards to refresh their database versions because the refresh diff --git a/jstests/core/txns/noop_createIndexes_not_blocked_by_txn.js b/jstests/core/txns/noop_createIndexes_not_blocked_by_txn.js index ef03baab8cd..270cb823202 100644 --- a/jstests/core/txns/noop_createIndexes_not_blocked_by_txn.js +++ b/jstests/core/txns/noop_createIndexes_not_blocked_by_txn.js @@ -16,7 +16,7 @@ testDB.runCommand({drop: collName, writeConcern: {w: "majority"}}); const session = db.getMongo().startSession({causalConsistency: false}); const sessionDB = session.getDatabase(dbName); -const isMongos = assert.commandWorked(db.runCommand("ismaster")).msg === "isdbgrid"; +const isMongos = assert.commandWorked(db.runCommand("hello")).msg === "isdbgrid"; if (isMongos) { // Access the collection before creating indexes so it can be implicitly sharded. assert.eq(sessionDB[collName].find().itcount(), 0); diff --git a/jstests/core/txns/statement_ids_accepted.js b/jstests/core/txns/statement_ids_accepted.js index bf73cbff55b..e0a6e3a9734 100644 --- a/jstests/core/txns/statement_ids_accepted.js +++ b/jstests/core/txns/statement_ids_accepted.js @@ -164,7 +164,7 @@ assert.commandWorked(sessionDb.adminCommand({ autocommit: false })); -const isMongos = assert.commandWorked(db.runCommand("ismaster")).msg === "isdbgrid"; +const isMongos = assert.commandWorked(db.runCommand("hello")).msg === "isdbgrid"; if (!isMongos) { // Skip commands that do not exist on mongos. diff --git a/jstests/core/views/invalid_system_views.js b/jstests/core/views/invalid_system_views.js index 8e0939d313e..153af23d0db 100644 --- a/jstests/core/views/invalid_system_views.js +++ b/jstests/core/views/invalid_system_views.js @@ -16,7 +16,7 @@ (function() { "use strict"; const isMongos = db.runCommand({isdbgrid: 1}).isdbgrid; -const isStandalone = !isMongos && !db.runCommand({isMaster: 1}).hasOwnProperty("setName"); +const isStandalone = !isMongos && !db.runCommand({hello: 1}).hasOwnProperty("setName"); function runTest(badViewDefinition) { let viewsDB = db.getSiblingDB("invalid_system_views"); diff --git a/jstests/core/views/views_all_commands.js b/jstests/core/views/views_all_commands.js index 17dea19f4f9..82d21378f27 100644 --- a/jstests/core/views/views_all_commands.js +++ b/jstests/core/views/views_all_commands.js @@ -606,9 +606,9 @@ let assertCommandOrWriteFailed = function(res, code, msg) { }; // Are we on a mongos? -var isMaster = db.runCommand("ismaster"); -assert.commandWorked(isMaster); -var isMongos = (isMaster.msg === "isdbgrid"); +var hello = db.runCommand("hello"); +assert.commandWorked(hello); +var isMongos = (hello.msg === "isdbgrid"); // Obtain a list of all commands. let res = db.runCommand({listCommands: 1}); diff --git a/jstests/core/views/views_stats.js b/jstests/core/views/views_stats.js index f51cd46d4c3..26ce01381e9 100644 --- a/jstests/core/views/views_stats.js +++ b/jstests/core/views/views_stats.js @@ -39,8 +39,8 @@ lastHistogram = assertHistogramDiffEq(view, lastHistogram, 0, 1, 0); assert.writeError(view.update({}, {})); lastHistogram = assertHistogramDiffEq(view, lastHistogram, 0, 1, 0); -let isMasterResponse = assert.commandWorked(viewsDB.runCommand("isMaster")); -const isMongos = (isMasterResponse.msg === "isdbgrid"); +let helloResponse = assert.commandWorked(viewsDB.runCommand("hello")); +const isMongos = (helloResponse.msg === "isdbgrid"); if (isMongos) { jsTest.log("Tests are being run on a mongos; skipping top tests."); return; diff --git a/jstests/core/write_result.js b/jstests/core/write_result.js index 49735bee7d6..b5ba3284445 100644 --- a/jstests/core/write_result.js +++ b/jstests/core/write_result.js @@ -185,7 +185,7 @@ coll.unsetWriteConcern(); // NOTE: In a replica set write concern is checked after write coll.remove({}); var wRes = assert.writeError(coll.insert({foo: "bar"}, {writeConcern: {w: "invalid"}})); -var res = assert.commandWorked(db.isMaster()); +var res = assert.commandWorked(db.hello()); var replSet = res.hasOwnProperty("setName"); if (!replSet && coll.getMongo().writeMode() == "commands") assert.eq(coll.count(), 0, "not-replset || command mode"); diff --git a/jstests/gle/opcounters_legacy.js b/jstests/gle/opcounters_legacy.js index 425f6bb4f42..86624583451 100644 --- a/jstests/gle/opcounters_legacy.js +++ b/jstests/gle/opcounters_legacy.js @@ -10,7 +10,7 @@ mongo.writeMode = function() { db = mongo.getDB(db.toString()); var t = db.opcounters; -var isMongos = ("isdbgrid" == db.runCommand("ismaster").msg); +var isMongos = ("isdbgrid" == db.runCommand("hello").msg); var opCounters; // diff --git a/jstests/ssl/config-canonicalize-normal-ports.js b/jstests/ssl/config-canonicalize-normal-ports.js index c04eed0bd32..e1e8f176a92 100644 --- a/jstests/ssl/config-canonicalize-normal-ports.js +++ b/jstests/ssl/config-canonicalize-normal-ports.js @@ -8,6 +8,6 @@ const mongod = MongoRunner.runMongod({ tlsCertificateKeyFile: 'jstests/libs/server.pem', }); assert(mongod); -assert.commandWorked(mongod.getDB('admin').runCommand({isMaster: 1})); +assert.commandWorked(mongod.getDB('admin').runCommand({hello: 1})); MongoRunner.stopMongod(mongod); })(); diff --git a/jstests/ssl/repl_ssl_split_horizon.js b/jstests/ssl/repl_ssl_split_horizon.js index bc6411510ec..44f6fc8f9d2 100644 --- a/jstests/ssl/repl_ssl_split_horizon.js +++ b/jstests/ssl/repl_ssl_split_horizon.js @@ -107,7 +107,9 @@ config.members[1].horizons.horizon_name = node1horizonHostname; replTest.initiate(config); var checkExpectedHorizon = function(url, memberIndex, expectedHostname) { - // Run isMaster in the shell and check that we get the expected hostname back + // Run isMaster in the shell and check that we get the expected hostname back. We must use the + // isMaster command instead of its alias hello, as the initial handshake between the shell and + // server use isMaster. const assertion = (memberIndex === "me") ? ("assert(db.runCommand({isMaster: 1})['me'] == '" + expectedHostname + "')") : ("assert(db.runCommand({isMaster: 1})['hosts'][" + memberIndex + "] == '" + diff --git a/jstests/ssl/set_parameter_ssl.js b/jstests/ssl/set_parameter_ssl.js index ddb46df2309..1a39cbd22a2 100644 --- a/jstests/ssl/set_parameter_ssl.js +++ b/jstests/ssl/set_parameter_ssl.js @@ -45,7 +45,7 @@ function testTransportTransition(scheme, oldMode, newMode, shouldSucceed) { } let uri = `mongodb://localhost:${conn.port}/admin`; - let exitCode = runMongoProgram("mongo", uri, "--eval", "assert.commandWorked(db.isMaster())"); + let exitCode = runMongoProgram("mongo", uri, "--eval", "assert.commandWorked(db.hello())"); assert.neq(exitCode, 0, "Was able to connect without SSL when SSLMode was requireSSL"); MongoRunner.stopMongod(conn); } diff --git a/jstests/ssl/ssl_cluster_ca.js b/jstests/ssl/ssl_cluster_ca.js index 5a934fb272b..babe3821bef 100644 --- a/jstests/ssl/ssl_cluster_ca.js +++ b/jstests/ssl/ssl_cluster_ca.js @@ -15,7 +15,7 @@ function testRS(opts, succeed) { rs.startSet(); if (succeed) { rs.initiate(); - assert.commandWorked(rs.getPrimary().getDB('admin').runCommand({isMaster: 1})); + assert.commandWorked(rs.getPrimary().getDB('admin').runCommand({hello: 1})); } else { // The rs.initiate will fail in an assert.soon, which would ordinarily trigger the hang // analyzer. We don't want that to happen, so we disable it here. diff --git a/jstests/ssl/ssl_uri.js b/jstests/ssl/ssl_uri.js index 6a6bfc876f0..e2b8e608593 100644 --- a/jstests/ssl/ssl_uri.js +++ b/jstests/ssl/ssl_uri.js @@ -5,7 +5,7 @@ var shouldSucceed = function(uri) { var conn = new Mongo(uri); - var res = conn.getDB('admin').runCommand({"ismaster": 1}); + var res = conn.getDB('admin').runCommand({"hello": 1}); assert(res.ok); }; @@ -39,7 +39,7 @@ var connectWithURI = function(uri) { 'jstests/libs/client.pem', uri, '--eval', - 'db.runCommand({ismaster: 1})'); + 'db.runCommand({hello: 1})'); }; var shouldConnect = function(uri) { @@ -56,7 +56,7 @@ shouldNotConnect(sslURI + "?ssl=false"); shouldConnect(sslURI + "?ssl=true"); // Connecting with ssl=true without --ssl will not work -var res = runMongoProgram('mongo', sslURI + "?ssl=true", '--eval', 'db.runCommand({ismaster: 1})'); +var res = runMongoProgram('mongo', sslURI + "?ssl=true", '--eval', 'db.runCommand({hello: 1})'); assert.eq(res, 1, "should not have been able to connect without --ssl"); // Clean up diff --git a/jstests/sslSpecial/ssl_ecdsa_cert.js b/jstests/sslSpecial/ssl_ecdsa_cert.js index 331844162dc..25d58627220 100644 --- a/jstests/sslSpecial/ssl_ecdsa_cert.js +++ b/jstests/sslSpecial/ssl_ecdsa_cert.js @@ -31,7 +31,7 @@ const test = () => { '--port', mongod.port, '--eval', - 'db.isMaster()'), + 'db.hello()'), "mongo did not initialize properly"); // Add an X509 user diff --git a/jstests/sslSpecial/x509_cluster_auth_rollover.js b/jstests/sslSpecial/x509_cluster_auth_rollover.js index 8aa50d50902..b9d51c1ced3 100644 --- a/jstests/sslSpecial/x509_cluster_auth_rollover.js +++ b/jstests/sslSpecial/x509_cluster_auth_rollover.js @@ -56,7 +56,7 @@ const rolloverConfig = function(newConfig) { assert.soon(() => { let primary = rst.getPrimary(); - assert.commandWorked(primary.getDB("admin").runCommand({isMaster: 1})); + assert.commandWorked(primary.getDB("admin").runCommand({hello: 1})); assert.commandWorked(primary.getDB('test').a.insert({a: 1, str: 'TESTTESTTEST'})); // Start a shell that connects to the server with the current CA/cert configuration -- cgit v1.2.1