diff options
author | Adam Rayner <adam.rayner@gmail.com> | 2022-02-01 16:25:00 +0000 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2022-02-01 17:40:48 +0000 |
commit | 7eef36be761b550bd5aeace4494852eb87e085a4 (patch) | |
tree | 6a21b8830a154d8eb85b593c153482a802406b55 /jstests/auth/benchrun_scram.js | |
parent | 51e13de10058a9048b71d3be179116df117b5c70 (diff) | |
download | mongo-7eef36be761b550bd5aeace4494852eb87e085a4.tar.gz |
SERVER-62334 Use SASL mech negotiation to get mech for DBClientBase::auth
Diffstat (limited to 'jstests/auth/benchrun_scram.js')
-rw-r--r-- | jstests/auth/benchrun_scram.js | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/jstests/auth/benchrun_scram.js b/jstests/auth/benchrun_scram.js new file mode 100644 index 00000000000..c2a0745443a --- /dev/null +++ b/jstests/auth/benchrun_scram.js @@ -0,0 +1,40 @@ +// Ensure that benchRun tests are able to use either SCRAM-SHA-1 or SCRAM-SHA-256 via mech +// negotiation from server +(function() { +"use strict"; + +function benchRunnerAuthWithProvidedMech(mechanism) { + var m = MongoRunner.runMongod({setParameter: 'authenticationMechanisms=' + mechanism}); + + const db = 'admin'; + const user = 'scram_test'; + const pwd = 'something'; + + const admin = m.getDB(db); + admin.createUser({user: user, pwd: pwd, roles: [], mechanisms: [mechanism]}); + + const ops = []; + + const seconds = 1; + + const benchArgs = { + ops: ops, + parallel: 2, + seconds: seconds, + host: m.host, + db: db, + username: user, + password: pwd + }; + + const res = assert.doesNotThrow( + benchRun, [benchArgs], "BenchRun attempted SASL negotiation. Server supports " + mechanism); + + printjson(res); + + MongoRunner.stopMongod(m); +} + +benchRunnerAuthWithProvidedMech("SCRAM-SHA-1"); +benchRunnerAuthWithProvidedMech("SCRAM-SHA-256"); +})(); |