mongo/jstests/auth/repl_require_keyfile.js
2023-04-26 19:19:19 +00:00

18 lines
505 B
JavaScript

// Validate that starting a replica set with auth enabled requires a keyfile
(function() {
'use strict';
const rsTest = new ReplSetTest({nodes: 1});
clearRawMongoProgramOutput();
assert.throws(function() {
rsTest.startSet({auth: "", oplogSize: 10});
});
const mongoOutput = rawMongoProgramOutput();
assert(mongoOutput.indexOf(
"security.keyFile is required when authorization is enabled with replica sets") >= 0,
"Expected error message about missing keyFile on startup");
})();