blob: 7a1e7f9fbfa19f621f0c5172d6ecace224d84130 (
plain)
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
|
// Tests the connectionStatus command
var dbName = 'connection_status';
var myDB = db.getSiblingDB(dbName);
function test(userName) {
myDB.addUser(userName, "weak password");
myDB.auth(userName, "weak password");
var output = myDB.runCommand("connectionStatus");
assert.commandWorked(output);
var users = output.authInfo.authenticatedUsers;
var matches = 0;
for (var i=0; i < users.length; i++) {
if (users[i].userSource != dbName)
continue;
assert.eq(users[i].user, userName);
matches++;
}
assert.eq(matches, 1);
}
test("someone");
test("someone else"); // replaces someone
|