summaryrefslogtreecommitdiff
path: root/jstests
diff options
context:
space:
mode:
authorSara Golemon <sara.golemon@mongodb.com>2019-07-02 15:37:23 +0000
committerSara Golemon <sara.golemon@mongodb.com>2019-07-08 23:59:33 +0000
commit96bb83d7fd650605413186a42a5de16289673d35 (patch)
tree18c31935b7a59e74b5174726a73c7e13b8558e5c /jstests
parent3ed19ce7c51a84999fa85ba5b644f4972e7037cb (diff)
downloadmongo-96bb83d7fd650605413186a42a5de16289673d35.tar.gz
SERVER-41903 Validate server parameter names during config validation
(cherry picked from commit f8cdf774a81b3af8825ac76eaebef1fd48183b5a)
Diffstat (limited to 'jstests')
-rw-r--r--jstests/noPassthrough/unknown-set-parameter.js36
1 files changed, 36 insertions, 0 deletions
diff --git a/jstests/noPassthrough/unknown-set-parameter.js b/jstests/noPassthrough/unknown-set-parameter.js
new file mode 100644
index 00000000000..1e72694e276
--- /dev/null
+++ b/jstests/noPassthrough/unknown-set-parameter.js
@@ -0,0 +1,36 @@
+// Verify error is produced when specifying an invalid set parameter.
+
+(function() {
+ 'use strict';
+
+ function tryRun(arg) {
+ // runMongoProgram helpfully makes certain that we pass a port when invoking mongod.
+ return runMongoProgram('./mongod', '--port', 0, '--setParameter', arg, '--outputConfig');
+ }
+
+ // Positive case, valid setparam.
+ clearRawMongoProgramOutput();
+ const valid = tryRun('enableTestCommands=1');
+ assert.eq(valid, 0);
+ const validOutput = rawMongoProgramOutput();
+ assert.gte(validOutput.search(/enableTestCommands: 1/), 0, validOutput);
+
+ // Negative case, invalid setparam.
+ clearRawMongoProgramOutput();
+ const foo = tryRun('foo=bar');
+ assert.neq(foo, 0);
+ const fooOutput = rawMongoProgramOutput();
+ assert.gte(fooOutput.search(/Unknown --setParameter 'foo'/), 0, fooOutput);
+
+ // Negative case, valid but unavailable setparam.
+ clearRawMongoProgramOutput();
+ const graph = tryRun('roleGraphInvalidationIsFatal=true');
+ assert.neq(graph, 0);
+ const graphOutput = rawMongoProgramOutput();
+ assert.gte(
+ graphOutput.search(
+ /--setParameter 'roleGraphInvalidationIsFatal' only available when used with 'enableTestCommands'/),
+ 0,
+ fooOutput);
+
+}());