0
0
mirror of https://github.com/mongodb/mongo.git synced 2024-12-01 01:21:03 +01:00
mongodb/jstests/noPassthrough/internal_validate_features_as_master.js

33 lines
1.4 KiB
JavaScript
Raw Normal View History

// Tests the internalValidateFeaturesAsMaster server parameter.
(function() {
"use strict";
load("jstests/libs/get_index_helpers.js");
// internalValidateFeaturesAsMaster can be set via startup parameter.
let conn = MongoRunner.runMongod({setParameter: "internalValidateFeaturesAsMaster=1"});
assert.neq(null, conn, "mongod was unable to start up");
let res = conn.adminCommand({getParameter: 1, internalValidateFeaturesAsMaster: 1});
assert.commandWorked(res);
assert.eq(res.internalValidateFeaturesAsMaster, true);
MongoRunner.stopMongod(conn);
// internalValidateFeaturesAsMaster cannot be set with --replSet.
conn = MongoRunner.runMongod(
{replSet: "replSetName", setParameter: "internalValidateFeaturesAsMaster=0"});
assert.eq(null, conn, "mongod was unexpectedly able to start up");
conn = MongoRunner.runMongod(
{replSet: "replSetName", setParameter: "internalValidateFeaturesAsMaster=1"});
assert.eq(null, conn, "mongod was unexpectedly able to start up");
// internalValidateFeaturesAsMaster cannot be set via runtime parameter.
conn = MongoRunner.runMongod({});
assert.commandFailed(
conn.adminCommand({setParameter: 1, internalValidateFeaturesAsMaster: true}));
assert.commandFailed(
conn.adminCommand({setParameter: 1, internalValidateFeaturesAsMaster: false}));
MongoRunner.stopMongod(conn);
}());