SERVER-18276 Add test for auth enabled but no auth mechanisms. (#47695)

GitOrigin-RevId: 300dce415b7172a69c2b88906c8a25fbaea939d2
This commit is contained in:
Ken Martin 2026-02-09 10:29:06 -08:00 committed by MongoDB Bot
parent 4a3836398f
commit 50b7cd3881
3 changed files with 14 additions and 1 deletions

View File

@ -1,10 +1,10 @@
import {testGetCmdLineOptsMongod} from "jstests/libs/command_line/test_parsed_options.js";
import {testGetCmdLineOptsMongodFailed} from "jstests/libs/command_line/test_parsed_options.js";
let baseName = "jstests_auth_auth_options";
jsTest.log('Testing "auth" command line option');
let expectedResult = {"parsed": {"security": {"authorization": "enabled"}}};
testGetCmdLineOptsMongod({auth: ""}, expectedResult);
jsTest.log('Testing "noauth" command line option');
@ -47,4 +47,8 @@ expectedResult = {
};
testGetCmdLineOptsMongod({config: "jstests/libs/config_files/disable_noauth.ini"}, expectedResult);
// Test that we exit when authentication is enabled, but no auth mechanisms are set. See SERVER-7942.
jsTest.log("Testing authentication enabled, but no auth mechanisms set");
testGetCmdLineOptsMongodFailed({config: "jstests/libs/config_files/auth_conflict.json"});
print(baseName + " succeeded.");

View File

@ -3,3 +3,6 @@ filters:
- "set_profiling*":
approvers:
- 10gen/query-integration-observability
- "*auth*":
approvers:
- 10gen/server-security

View File

@ -0,0 +1,6 @@
{
"security" : {
"authorization" : "enabled",
"authenticationMechanisms" : [ ],
}
}