Files
mongo/jstests/auth/repl_require_keyfile.js
2023-08-06 20:48:04 +00:00

13 lines
469 B
JavaScript

// Validate that starting a replica set with auth enabled requires a keyfile
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");