diff options
Diffstat (limited to 'jstests/auth/authn_session_abandoned.js')
-rw-r--r-- | jstests/auth/authn_session_abandoned.js | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/jstests/auth/authn_session_abandoned.js b/jstests/auth/authn_session_abandoned.js new file mode 100644 index 00000000000..d5298ecbe02 --- /dev/null +++ b/jstests/auth/authn_session_abandoned.js @@ -0,0 +1,31 @@ +// Test for auth counters in serverStatus. + +(function() { +'use strict'; +load('jstests/libs/parallel_shell_helpers.js'); + +const kFailedToAuthMsgId = 5286307; + +const mongod = MongoRunner.runMongod(); + +try { + mongod.getDB("admin").createUser( + {"user": "admin", "pwd": "pwd", roles: ['root'], mechanisms: ["SCRAM-SHA-256"]}); + + const shellCmd = () => { + // base64 encoded: 'n,,n=admin,r=deadbeefcafeba11'; + const kClientPayload = 'biwsbj1hZG1pbixyPWRlYWRiZWVmY2FmZWJhMTE='; + + db.getSiblingDB("admin").runCommand( + {saslStart: 1, mechanism: "SCRAM-SHA-256", payload: kClientPayload}); + }; + + startParallelShell(shellCmd, mongod.port)(); + + assert.soon(() => checkLog.checkContainsOnceJson( + mongod, kFailedToAuthMsgId, {"result": ErrorCodes.AuthenticationAbandoned})); + +} finally { + MongoRunner.stopMongod(mongod); +} +})(); |