diff options
author | Yoonsoo Kim <yoonsoo.kim@mongodb.com> | 2022-09-19 19:48:09 +0000 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2022-09-19 20:41:59 +0000 |
commit | 5f965bd777834a96e9fcffff740250240f28124c (patch) | |
tree | 3e69c88948c855be223582f3b891c4be658ccd56 /jstests | |
parent | 279ee64be148ce7bbba7a6414adca53e08dc72df (diff) | |
download | mongo-5f965bd777834a96e9fcffff740250240f28124c.tar.gz |
SERVER-69682 Add enableComputeMode start-up parameter
Diffstat (limited to 'jstests')
-rw-r--r-- | jstests/noPassthrough/compute_mode.js | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/jstests/noPassthrough/compute_mode.js b/jstests/noPassthrough/compute_mode.js new file mode 100644 index 00000000000..3f732495db9 --- /dev/null +++ b/jstests/noPassthrough/compute_mode.js @@ -0,0 +1,54 @@ +// Tests compute mode. +// +// @tags: [requires_sharding] +(function() { +'use strict'; + +const mongodOption = { + setParameter: "enableComputeMode=true" +}; + +const shardsvrOption = { + replSet: jsTestName(), + shardsvr: "", + setParameter: "enableComputeMode=true" +}; + +const configsvrOption = { + replSet: jsTestName(), + configsvr: "", + setParameter: "enableComputeMode=true" +}; + +(function testComputeModeInStandaloneMongod() { + const conn = MongoRunner.runMongod(mongodOption); + + const db = conn.getDB("admin"); + const startupLogResults = assert.commandWorked(db.adminCommand({getLog: "startupWarnings"}), + "ERROR from getting startupWarnings"); + assert.gt(startupLogResults.totalLinesWritten, 0, "ERROR from count of startup log message"); + + let warningMsgFound = false; + startupLogResults.log.forEach(log => { + if (log.match("6968201")) { + warningMsgFound = true; + } + }); + assert(warningMsgFound, "ERROR from warning message match"); + + MongoRunner.stopMongod(conn); +})(); + +(function testComputeModeWithReplSet() { + const rs = new ReplSetTest({nodes: 1}); + assert.throws(() => rs.startSet(mongodOption), [], "ERROR from replset test"); +})(); + +(function testComputeModeWithShardedCluster() { + const rs = new ReplSetTest({nodes: 1}); + // This emulates that mongod is running as a shard. + assert.throws(() => rs.startSet(shardsvrOption), [], "ERROR from shardsvr test"); + // This emulates that mongod is running as a config server. + assert.throws(() => rs.startSet(configsvrOption), [], "ERROR from configsvr test"); +})(); +}()); |