diff --git a/jstests/auth/auth_options.js b/jstests/auth/auth_options.js index 70cb53f8e39..2d8944fb534 100644 --- a/jstests/auth/auth_options.js +++ b/jstests/auth/auth_options.js @@ -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."); diff --git a/jstests/libs/config_files/OWNERS.yml b/jstests/libs/config_files/OWNERS.yml index a4883d90e68..51494a3bea8 100644 --- a/jstests/libs/config_files/OWNERS.yml +++ b/jstests/libs/config_files/OWNERS.yml @@ -3,3 +3,6 @@ filters: - "set_profiling*": approvers: - 10gen/query-integration-observability + - "*auth*": + approvers: + - 10gen/server-security diff --git a/jstests/libs/config_files/auth_conflict.json b/jstests/libs/config_files/auth_conflict.json new file mode 100644 index 00000000000..5ef4f927041 --- /dev/null +++ b/jstests/libs/config_files/auth_conflict.json @@ -0,0 +1,6 @@ +{ + "security" : { + "authorization" : "enabled", + "authenticationMechanisms" : [ ], + } +}