forked from mongodb/mongo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbenchrun_scram.js
36 lines (27 loc) · 981 Bytes
/
benchrun_scram.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
// Ensure that benchRun tests are able to use either SCRAM-SHA-1 or SCRAM-SHA-256 via mech
// negotiation from server
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");