summaryrefslogtreecommitdiff
path: root/jstests/noPassthrough
diff options
context:
space:
mode:
authorMarcos José Grillo Ramirez <marcos.grillo@mongodb.com>2021-07-02 13:18:51 +0200
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2021-07-02 17:10:37 +0000
commit92a0de6ce7e8dfb312d93f499ca5e3c0f6caa945 (patch)
treee3a84a17f1a1d7614a06162eb2887ede3d189fba /jstests/noPassthrough
parent73e334a22d652feda2fb7f135e314f95146bbe6c (diff)
downloadmongo-92a0de6ce7e8dfb312d93f499ca5e3c0f6caa945.tar.gz
SERVER-32531 Disalow standalone nodes as shards if no queryableBackupMode is enabled
Diffstat (limited to 'jstests/noPassthrough')
-rw-r--r--jstests/noPassthrough/require_api_version.js14
1 files changed, 9 insertions, 5 deletions
diff --git a/jstests/noPassthrough/require_api_version.js b/jstests/noPassthrough/require_api_version.js
index 661f33ea886..7e5e5fb5369 100644
--- a/jstests/noPassthrough/require_api_version.js
+++ b/jstests/noPassthrough/require_api_version.js
@@ -127,7 +127,8 @@ function runTest(db, supportsTransctions, writeConcern = {}, secondaries = []) {
function requireApiVersionOnShardOrConfigServerTest() {
assert.throws(
- () => MongoRunner.runMongod({shardsvr: "", setParameter: {"requireApiVersion": true}}),
+ () => MongoRunner.runMongod(
+ {shardsvr: "", replSet: "dummy", setParameter: {"requireApiVersion": true}}),
[],
"mongod should not be able to start up with --shardsvr and requireApiVersion=true");
@@ -136,12 +137,15 @@ function requireApiVersionOnShardOrConfigServerTest() {
[],
"mongod should not be able to start up with --configsvr and requireApiVersion=true");
- const shardsvrMongod = MongoRunner.runMongod({shardsvr: ""});
- assert.neq(null, shardsvrMongod, "mongod was not able to start up");
+ const rs = new ReplSetTest({nodes: 1});
+ rs.startSet({shardsvr: ""});
+ rs.initiate();
+ const singleNodeShard = rs.getPrimary();
+ assert.neq(null, singleNodeShard, "mongod was not able to start up");
assert.commandFailed(
- shardsvrMongod.adminCommand({setParameter: 1, requireApiVersion: true}),
+ singleNodeShard.adminCommand({setParameter: 1, requireApiVersion: true}),
"should not be able to set requireApiVersion=true on mongod that was started with --shardsvr");
- MongoRunner.stopMongod(shardsvrMongod);
+ rs.stopSet();
const configsvrMongod = MongoRunner.runMongod({configsvr: ""});
assert.neq(null, configsvrMongod, "mongod was not able to start up");